Foreground/background separation using reference images

ABSTRACT

A technique involves distinguishing between foreground and background regions of a digital image of a scene. First and second images are captured of nominally a same scene. The first image is a relatively high resolution image taken with the foreground more in focus than the background, while the second image is a relatively low resolution reference image taken with the background more in focus than the foreground. Regions of the captured images are assigned as foreground or background. In accordance with the assigning, one or more processed images are rendered based on the first image or the second image, or both.

PRIORITY AND RELATED APPLICATIONS

This application claims priority to U.S. provision patent applicationSer. No. 60/945,558, filed Jun. 21, 2007.

This application is a continuation in part (CIP) of U.S. patentapplication Ser. No. 11/573,713, filed Feb. 14, 2007, now U.S. Pat. No.7,868,922; which claims priority to U.S. provisional patent applicationno. 60/773,714, filed Feb. 14, 2006, and to PCT application no.PCT/EP2006/008229, filed Aug. 15, 2006, published as WO 2007/093199.

This application is also a CIP of U.S. patent application Ser. No.11/319,766, filed Dec. 27, 2005, now U.S. Pat. 7,692,696.

This application also is related to 11/024,046, filed Dec. 27, 2004, nowU.S. Pat. No. 7,565,030; which is a CIP of U.S. patent application Ser.No. 10/608,772, filed Jun. 26,2003, now U.S. Pat. 7,440,593.

This application also is related to PCT/US2006/021393, filed Jun. 2,2006, published as WO 2007/142621; which is a CIP of 10/608,784, filedJun. 26, 2003.

This application also is related to U.S. application Ser. No.10/985,657, filed Nov. 10, 2004, now U.S. Pat. No. 7,636,486.

This application also is related to US application 11/462,035, filedAug. 2, 2006, now U.S. Pat. No. 7,920,723; which is a CIP of U.S.application Ser. No. 11/282,954, filed Nov. 18, 2005, now U.S. Pat. No.7,689,009.

This application also is related to 11/233,513, filed Sep. 21, 2005, nowU.S. Pat. No. 7,587,085; which is a CIP of U.S. application Ser. No.11/182,718, filed Jul. 15, 2005, now Abandoned; which is a CIP of U.S.application Ser. No. 11/123,971, filed May 6, 2005, now U.S. Pat. No.7,436,998; and which is a CIP of U.S. application Ser. No. 10/976,336,filed Oct. 28, 2004, now U.S. Pat. No. 7,536,036.

This application also is related to U.S. patent application Ser. No.11/460,218, filed Jul. 26, 2006, now U.S. Pat. No. 7,792,335; whichclaims priority to U.S. provisional patent application Ser. No.60/776,338, filed Feb. 24, 2006.

This application also is related to U.S. patent application Ser. No.12/063,089, filed Feb 6, 2008, which is a CIP of U.S. Ser. No.11/766,674, filed Jun. 21, 2007, now U.S. Pat. No. 7,460,695; which is aCIP of U.S. Ser. No. 11/753,397, now U.S. Pat. No. 7,403,643; which is aCIP of U.S. Ser. No. 11/765,212, filed Aug. 11, 2006, now U.S. Pat. No.7,315,631.

This application also is related to U.S. patent application Ser. No.11/674,650, filed Feb. 13, 2007, now U.S. Pat. No. 7,702,236; whichclaims priority to U.S. provisional patent application Ser. No.60/773,714, filed Feb. 14, 2006.

This application is also related to U.S. Ser. No. 11/836,744, filed Aug9, 2007, which claims priority to U.S. provisional patent applicationSer. No. 60/821,956, filed Aug. 9, 2006.

This application is related to a family of applications filedcontemporaneously by the same inventors, including an applicationentitled DIGITAL IMAGE ENHANCEMENT WITH REFERENCE IMAGES (Ser. No.12/040,048), and another entitled METHOD OF GATHERING VISUAL META DATAUSING A REFERENCE IMAGE (Ser. No. 12/040,125), and another entitledIMAGE CAPTURE DEVICE WITH CONPEMPORANEOUS REFERENCE IMAGE CAPTUREMECHANISM (Ser. No. 12/040,532), and another entitled MODIFICATION OFPOST-VIEWING PARAMETERS FOR DIGITAL IMAGES USING IMAGE REGION OR FEATUREINFORMATION (Ser. No. 12/040,950) and another entitled REAL-TIME FACETRACKING WITH REFERENCE IMAGES (Ser. No. 12/041,042) and anotherentitled METHOD AND APPARATUS FOR RED-EYE DETECTION USING PREVIEW OROTHER REFERENCE IMAGES (Ser. No. 12/042,134).

All of these priority and related applications, and all references citedbelow, are hereby incorporated by reference.

FIELD OF THE INVENTION

The invention relates to enhancement of digital image processing in aportable image capture device by use supplementary meta data fromreference images.

BACKGROUND

It is recognized in the present invention that reference images ofvarious types can be used advantageously in processing and enhancingdigital images, particularly when efficiency is desired and/or whenvarious defects tend to be present in the images as originally-acquired.In some cases, existing techniques can be improved and in other cases,new techniques are made available.

Foreground/Background Separation

For some applications the ability to provide foreground/backgroundseparation in an image is useful. In US published application2006/0039690, separation based on an analysis of a flash and non-flashversion of an image is discussed. However, there are situations whereflash and non-flash versions of an image may not provide sufficientdiscrimination, e.g. in bright sunlight.

Depth from de-focus is an image processing technique which creates adepth map from two or more images with different focal lengths. Asummary of this technique can be found at:http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/FAVARO1/dfdtutorial.html.Favaro is based on a statistical analysis of radiance of two or moreimages—each out of focus—to determine depth of features in an image.Favaro is based on knowing that blurring of a pixel corresponds with agiven Gaussian convolution kernel and so applying an inverse convolutionindicates the extent of defocus of a pixel and this in turn can be usedto construct a depth map. Favaro involves a dedicated approach to depthcalculation once images have been acquired in that a separate radiancemap is created for each image used in depth calculations. Thisrepresents a substantial additional processing overhead compared to theexisting image acquisition process.

US published application 2003/0052991 discloses for each of a series ofimages taken at different focus settings, building a contrast map foreach pixel based on a product of the difference in pixel brightnesssurrounding a pixel. The greater the product of brightness differences,the more likely a pixel is considered to be in focus. The image with thegreatest contrast levels for a pixel is taken to indicate the distanceof the pixel from the viewfinder. This enables the camera to build adepth map for a scene. The camera application then implements asimulated fill flash based on the distance information. Here, thecontrast map is specifically built representing substantial additionalprocessing overhead over the existing image acquisition process.

US published application 2004/0076335 to Epson describes a method forlow depth of field image segmentation. The Epson technique involves someknowledge that sharply focused regions contain high frequencycomponents. US published application 2003/0219172 to Philips disclosescalculating the sharpness of a single image according to the Kurtosis(shape of distribution) of its Discrete Cosine Transform (DCT)coefficients. US published application 2004/0120598 to Xiao-Fan Fengdiscloses using DCT blocks of a single image to detect blur within theimage. The Epson, Philips and Feng techniques each involve an analysisof only a single image, and do not provide reliable distinctions betweenforeground and background regions of an image. US published application2003/0091225 describes a creation of a depth map from two “stereo”images. It is desired to have an improved method of distinguishingbetween foreground and background regions of a digital image.

Image Classifiers for Scene Analysis

Even though human beings have little trouble interpreting imagessemantically, the challenge to do so using artificial intelligence isnot that straight forward. A few methods are available to those familiarin the art of image and pattern recognition that separate images using alearning-based descriptor space. Such methods involve a training set andmaximization methods of likelihood. Examples of such methods includesthe Adatron (1989) method as described by Analauf et. al. (see citationbelow). Other work includes scene analysis such as the work by Le SauxBertrand et al. (2004), citation below.

Faces in Digital Images

Face tracking in digital image acquisition devices may be described asinvolving the marking or identification of human faces in a series ofimages such as a video stream or a camera preview. Face tracking can beused to indicate to a photographer the locations of faces in an image,thereby improving acquisition parameters, or for allowing postprocessing of the images based on some knowledge of the locations of thefaces.

In general, a face tracking system may employ two principle modules: (i)a face detection module for locating of new candidate face regions in anacquired image or a sequence of images; and (ii) a face tracking modulefor confirming face regions.

A fast-face detection algorithm is disclosed in US published application2002/0102024 to Viola-Jones. In brief, Viola-Jones involves deriving anintegral image from an acquired image, which is usually an image framein a video stream. Each element of the integral image is calculated asthe sum of intensities of all points above and to the left of the pointin the image. The total intensity of any sub-window in an image can thenbe derived by subtracting an integral image value for the top left pointof the sub-window from the integral image value for the bottom rightpoint of the sub-window. Intensities for adjacent sub-windows arecompared using particular combinations of integral image values frompoints of the sub-windows.

According to Viola-Jones, a chain (cascade) of 32 classifiers based onrectangular (and increasingly refined) Haar features may be used withthe integral image by applying the classifiers to a sub-window withinthe integral image. For a complete analysis of an acquired image, thissub-window is shifted incrementally across the integral image until theentire image has been covered.

In addition to moving the sub-window across the entire integral image,the sub window is also be scaled up or down to cover a range of facesizes. In Viola-Jones, a scaling factor of 1.25 is used and typically, arange of about 10-12 different scales is used to cover possible facesizes in an XVGA size image.

The resolution of the integral image may be determined by the smallestsized classifier sub-window, i.e. the smallest size face to be detected,as larger sized sub-windows can use intermediate points within theintegral image for their calculations.

There are a number of variants of the original Viola-Jones algorithmdescribed in the literature. These generally employ rectangular, Haarfeature classifiers and use the integral image techniques ofViola-Jones.

Even though Viola-Jones is significantly faster than other facedetectors, it still involves significant computation, e.g., on aPentium-class computer. In a resource-restricted embedded system, suchas hand-held image acquisition devices, (e.g., including digitalcameras, hand-held computers or cellular phones equipped with acameras), it is not generally practical to run such acomputationally-intensive face detector at real-time frame rates forvideo. From tests within a typical digital camera, it is only possibleto achieve complete coverage of all 10-12 sub-window scales with a 3-4classifier cascade. This allows some level of initial face detection tobe achieved, but with undesirably high false positive rates.

Viola and Jones in their paper entitled “Robust Real Time ObjectDetection” as presented in the 2^(nd) international workshop onStatistical and Computational theories of Vision, in Vancouver, Canada,Jul. 31, 2001, describe a visual object detection framework that iscapable of processing images extremely rapidly while achieving highdetection rates. The paper demonstrates a framework for the task of facedetection. The described technique is based on a learning algorithmwhere a small number of critical visual features yield a set ofclassifiers.

In US published application 2005/0147278 by Rui et al., a system isdescribed for automatic detection and tracking of multiple individualsusing multiple cues. Rui et al. disclose using Viola-Jones as a fastface detector. However, in order to avoid the processing overhead ofViola-Jones, Rui et al. instead disclose using an auto-initializationmodule which uses a combination of motion, audio and fast face detectionto detect new faces in the frame of a video sequence. The remainder ofthe system employs well-known face tracking methods to follow existingor newly discovered candidate face regions from frame to frame. It isalso noted that the Rui et al. technique involves some video framesbeing dropped in order to run a complete face detection process.

Yang et al., in IEEE Transactions on Pattern Analysis and MachineIntelligence, Vol. 24, No. 1, pages 34-58 (January 2002), have provideda useful and comprehensive review of face detection techniques. Theseauthors discuss various methods of face detection which may be dividedinto four main categories: (i) knowledge-based methods; (ii)feature-invariant approaches, including the identification of facialfeatures, texture and skin color; (iii) template matching methods, bothfixed and deformable and (iv) appearance-based methods, includingeigenface techniques, statistical distribution-based methods and neuralnetwork approaches. They also discuss a number of main applications forface detection technology. It is recognized in the present inventionthat none of these references describe detection and knowledge of facesin images to create and/or use tools for the enhancement and/orcorrection of images in accordance with the present invention and theseveral preferred and alternative embodiment set forth below, andparticularly to using reference images, such as preview or postviewimages these enhancements and/or corrections.

Baluja in 1997 (see citations below) described methods of extendingupright, frontal templates based on a face detection system toefficiently handle in-plane rotations, thus achieving a rotationinvariant face detection system.

It is recognized that human faces are perhaps the most photographedsubject matter for the amateur and professional photographer. Thus it ispossible to assume a high starting percentage for algorithms based onthe existence of faces in them.

Orientation

The camera is usually held horizontally or vertically, counter-clockwiseor clockwise in relation to the horizontal position when the picture istaken, creating what is referred to as landscape mode or portrait mode,respectively. Thus most images are taken in either one of the threeorientations, namely landscape, clockwise portrait and counter-clockwiseportrait. When viewing images, it is preferable to determine ahead oftime the orientation of the camera at acquisition, thus eliminating astep of rotating the image and automatically orienting the image. Thesystem may try to determine if the image was shot horizontally, which isalso referred to as landscape format, where the width is larger than theheight of an image, or vertically, also referred to as portrait mode,where the height of the image is larger than the width.

Techniques may be used to determine an orientation of an image.Primarily these techniques include either recording the cameraorientation at an acquisition time using an in-camera mechanicalindicator or attempting to analyze image content post-acquisition.In-camera methods, although providing precision, use additional hardwareand sometimes movable hardware components which can increase the priceof the camera and add a potential maintenance challenge. However,post-acquisition analysis may not generally provide sufficientprecision. Knowledge of location, size and orientation of faces in aphotograph, a computerized system can offer powerful automatic tools toenhance and correct such images or to provide options for enhancing andcorrecting images.

Face Recognition as a Function of Orientation

The human visual system is very sensitive to the orientation of faces.As a matter of fact, the way the human mind stores faces is differentfor upright and inverted faces, as described in Endo in 1982 (seecitation below). In particular, recognition of inverted faces is knownto be a difficult perceptual task. While the human visual systemperforms well in recognizing different faces, performing the same taskwith inverted faces is significantly worse. Such results wereillustrated for example by Moses in 1994 (see citation below), whereface memory and face recognition is determined to be highly orientationdependent. A detailed review of face recognition of inverted faces wasmade available by Valentine in 1988 (see citation below).

It is therefore only natural that artificial intelligence detectionalgorithms based on face-related classifiers may have the same featuresof being orientation-variant.

Cameras are becoming strong computation tools. In particular, FotoNationVision, Inc., assignee of the present application, has developed manyadvantageous face detection tools. Some of these are described at U.S.patent application Ser. Nos. 10/608,776, 10/608,810, 10/764,339,10/919,226, 11/182,718, and 11/027,001, which are hereby incorporated byreference.

It is desired to have a smart system for disqualifying unsatisfactoryimages, particularly of faces, and/or that alerts a photographer to takeanother picture due to poor quality of a previous picture. It is alsodesired to do so without using a trigger to take a picture, nor waitingfor an event that may or may not happen (e.g. a smile). U.S. Pat. No.6,301,440 discloses adjusting image capture parameters based on analysisof temporary images, and awaiting taking a picture until everyone in thetemporary images is smiling. The camera must await a certain event thatmay or may not ever happen. It is many times not acceptable to makepeople wait for the camera to decide that a scene is optimal beforetaking a picture, and there is no description in the '440 patent thatwould alleviate such dilemma. The '440 patent also provides no guidanceas to how to detect or determine certain features within a scene. Thereare also security cameras that take pictures when a subject enters theview of the camera. However, these generally only detect motion orabrupt changes in what is generally a stagnant scene.

Correction of Red-Eye Defects

Redeye is the appearance of an unnatural reddish coloration of thepupils of a person appearing in an image captured by a camera with flashillumination. Red-eye is caused by light from the flash reflecting offblood vessels in a person's retina and returning to the camera.

A large number of image processing techniques have been proposed todetect and correct redeye in color images. In general, these techniquesmay be characterized as either semi-automatic or automatic.Semi-automatic red-eye detection techniques rely on human input. Forexample, in some semi-automatic red-eye reduction systems, a usermanually identifies to the system the areas of an image containingred-eye before the defects can be corrected.

An automatic red-eye reduction system may rely on a preliminarydetection of any faces in an image before red-eye areas are detected.One automatic approach may involve detecting faces in an image and,subsequently, detecting eyes within each detected face. After the eyesare located, red-eye is identified based on shape, coloration, and/orbrightness of image areas corresponding to the detected eye locations.In general, face detection-based automatic red-eye reduction techniqueshave high computation and memory resource requirements. In addition,most of the face detection algorithms are only able to detect faces thatare oriented in an upright frontal view. These approaches generally donot detect faces that are rotated in-plane or out-of-plane with respectto the image plane.

U.S. Pat. No. 6,407,777, having inventor DeLuca and assignee Fotonation,discloses in-camera detection and correction of redeye pixels in anacquired digital image, while US published patent application2002/0176623 to inventor Steinberg discloses automated real-timedetection and correction of redeye defects optimized for handhelddevices (see also U.S. application Ser. Nos. 10/919,226, filed Aug. 16,2004, 10/772,092, filed Feb. 4, 2004, 10/773,092, filed Feb. 4, 2004,and 10/635,918, filed Aug. 5, 2003). US published patent applications2005/0047655 and 2005/0047656 to Luo et al disclose techniques fordetecting and correcting redeye in a digital image and in embeddedsystems, respectively.

Within an image acquisition subsystem such as is embodied in typicaldigital cameras, a peak computing load and resource requirements occuraround the time of image acquisition. Upon receiving an imageacquisition request from the user the main embedded processing systemrefines the image focus and exposure to achieve an optimal main acquiredimage. This image, in turn, is off-loaded from the main optical sensorof the camera and subjected to further image processing to convert itfrom its raw format (e.g. Bayer) to a conventional color space such asRGB or YCC. Finally, the acquired image is compressed prior to saving iton a removable storage medium such as a compact flash or multimediacard.

The time taken by the camera to recover from the acquisition of a firstimage and reinitialize itself to capture a second image is referred toas the “click-to-click” time. This parameter is used in the comparisonand marketing of modern digital cameras. It is desired for manufacturersto minimize this “click-to-click” time. Thus, it is desired that anyadditional image processing, such as redeye filtering, which is to beadded to the main image acquisition chain should be highly optimized forspeed of execution in order to minimize its impact on the click-to-clicktime of the main system. Such a redeye filter typically compromises itsoverall performance in terms of accuracy of detection of redeye defectsand quality of image correction.

An alternative would be to wait until after the main image has beenacquired and perform the redeye filtering at a later time when thecamera may execute the filter as a background process, or to perform theredeye filtering off-camera on a desktop PC or printer. There can bedrawbacks to this alternative approach, though. First, images aredisplayed on the acquiring device, immediately after acquisition, withuncorrected redeye defects. Second, when images are accessed in playbackmode, there is a further delay while images are post-processed before animage can be displayed. Both drawbacks would create a negativeimpression on end users.

Further, as most digital cameras store images using lossy compressiontechniques there can be additional disadvantages with respect to imagequality as images are decompressed and recompressed in order to performredeye detection and correction processes in playback or backgroundmodes. Such loss of image quality may not become apparent until laterwhen a user wishes to print an image and it is too late to reverse theprocess.

If redeye processing is delayed until the images are loaded onto anotherdevice, such as a desktop PC or printer, there can be furtherdisadvantages. First, meta-data relating to the acquiring device and itsstate at the time the image was acquired may not be available to theredeye filter process. Second, this post-processing device performsredeye filtering on the entire image; so that for an embedded devicesuch as a printer that may be relatively constrained in terms of CPUcycles and processing resources for its primary post-processingactivity, it would be desirable to optimize the performance of the fullredeye filter. It is generally desired to optimize the detection ofred-eye defects in digital images for embedded image acquisition andprocessing systems.

Most algorithms that involve image analysis and classification, arestatistical in nature. It is therefore desired to develop tools whichwill improve the probability of successful detection, while reducing theprobability of false detection, while maintaining optimal execution,especially in limited computational devices such as in handheld orotherwise portable digital cameras. In many cases, knowledge of imagecharacteristics such as image quality may affect the design parametersand decisions the detection and correction software uses. For example animage with suboptimal exposure may deteriorate the overall detection ofred-eye defects. It is desired to have a method of improving a successrate of efficient algorithms for detecting and reducing red-eyephenomenon by utilizing information, meta-data and/or image data fromreference images.

Correction of Dust Defects

A map of defects caused by dust particles present in optical elements ofa digital image acquisition device may be generated, and used inprocessing images captured by the device. For example, FIG. 1 of USpublished patent application no. 2003/0193604 to Robins illustrates aset of LEDs 38 or 38a disposed within camera lens elements 42, 44, 46and, with the lens cover 36, 36a in place, lighting the LEDs andacquiring a calibration image from the camera sensor to detectcontamination of the camera lens elements. In addition, published PCTapplication no. PCT/EP2004/010199, which is assigned to Fotonation andcorresponding to one or more of seven sequentially numbered U.S.published applications nos. 2005/0068446 through '68452, and2005/0078173 disclose building a statistical dust map based oninformation derived from one or more images acquired by a camera. Whileworking with camera companies, there is a constant complaint about ORBSwhich are undesirable artefacts in images. Scientifically they arereflections of water or dust particles. As to correction, Kodak hasworked on detection and correction of defective-colored eyes (thus,round shapes). For example, U.S. Pat. No. 7,035,462 describes anapparatus and method for processing digital images having eye colordefects. The correction of artefacts is also approached at U.S. Pat. No.7,031,548, which describes a method and apparatus for filtering noisefrom a digital image. U.S. Pat. No. 6,614,946 discloses a system andmethod for correcting defects in digital images through selectivefill-in from surrounding areas. U.S. Pat. No. 6,160,923 also relates tothis issue. It is desired to provide an efficient, quality dust or orbartifact correction technique for a hand-held or otherwise portable orspatial or temporal performance-based image capture device

SUMMARY OF THE INVENTION

A digital image processing method includes capturing, on a hand-held orotherwise portable or spatial or temporal performance-based imagecapture device, an original main image and one or more reference imageshaving a temporal or spatial overlap or proximity with the originalimage, or combinations thereof. The method also includes in general theability to obtain supplemental or complementary data, such as visualinformation to the captured image, using a reference image. In oneembodiment, such data analysis includes assessing on the device that theoriginal main image has one or more defects or otherwise sub-optimalcharacteristics. Information, image data or meta data, or combinationsthereof, of the one or more reference images relating to the one or moredefects or otherwise sub-optimal characteristics of the original mainimage are analyzed on the device. The one or more defects or othersub-optimal characteristics in the original main image are corrected onthe device based on the information, image data or meta data, orcombinations thereof, of the one or more reference images. Thus, amodified image is created than includes an enhanced version of theoriginal main image. The modified image is rendered at a digitalrendering device, display or printer, or combinations thereof, as outputfrom the image capture device. The correcting of the one or more defectsor other sub-optimal characteristics of the original main image based onthe one or more reference images produces at the device the modifiedimage from the original main image in real-time with spatial economy andperformance efficiency.

The original main image and at least one reference image may includeflash and non-flash versions of a substantially same scene. The originalmain image may be segmented into foreground and background regions, atleast one of which may be modified based on the one or more referenceimages. A region containing a face may be detected within the originalmain image, and the face region may be modified based on the one or morereference images. A red-eye defect may be corrected within the faceregion of the original main image. A blur defect may be corrected in theoriginal main image based on the one or more reference images. A dustartifact defect may be corrected in the original main image based on theone or more reference images.

A hand-held or otherwise portable or spatial or temporalperformance-based image capture device may include one or more lenses,and a corresponding one or more sensors configured to provide a closelyoverlapping or identical temporal proximity between the acquired imageand the reference image. Alternatively, the reference image may beacquired using the same optical system but at different times, e.g.,just before or just after acquiring the main image. The device may alsoinclude an aperture and a photodetector for capturing the original mainimage and the one or more reference images, as well as a processor, andone or more processor-readable media having embedded therein programmingcode for the processor to perform a digital image processing method asdescribed above or below herein.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of a camera apparatus operating in accordancewith certain embodiments.

FIG. 2 shows the workflow of a method according to certain embodiments.

FIG. 3 illustrates a foreground/background map for a portrait image.

FIG. 4 is a flow diagram that illustrates a main orientation workflowbased on rotation of a digital image that includes one or more faces.

FIG. 5 is a flow diagram that illustrates a main orientation workflowbased on rotation of classifiers relative to an orientation of a digitalimage that includes one or more faces.

FIG. 6 illustrates the workflow of the initial stage of a camera motionblur reducing means using preview data according to certain embodiments.

FIGS. 7A-7B are workflows illustrating further embodiments.

FIGS. 8, 9, and 10 are motion diagrams which assist in the understandingof the previous embodiment.

FIG. 11 illustrates a functional implementation of modified redeyefiltering process according to another embodiment.

FIG. 12 illustrates a redeye filter chain of a red eye detection systemin accordance with another embodiment.

FIG. 13 illustrates a method of predicting a blinking completion timeinterval in accordance with a preferred embodiment.

FIG. 14 illustrates a method of determining a degree to which an eye isopen or shut in accordance with another embodiment.

FIG. 15 illustrates a method of assembling a combination image inaccordance with another embodiment.

FIG. 16 illustrates a generic workflow of utilizing eye information inan image to delay image acquisition in accordance with anotherembodiment.

FIG. 17 illustrates a generic workflow of utilizing face information ina single or a plurality of images to adjust the image renderingparameters prior to outputting the image in accordance with anotherembodiment.

FIG. 18 illustrates face, eye or mouth detection, or combinationsthereof, in accordance with one or more further embodiments.

FIG. 19 is a block diagram illustrating the principle components of animage processing apparatus according to a preferred embodiment.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

Several embodiments are described herein that use information obtainedfrom reference images for processing a main image. That is, the datathat are used to process the main image come at least not solely fromthe image itself, but instead or also from one or more separate“reference” images.

Reference Image

Reference images provide supplemental meta data, and in particularsupplemental visual data to an acquired image, or main image. Thereference image can be a single instance, or in general, a collection ofone or more images varying from each other. The so-defined referenceimage(s) provides additional information that may not be available aspart of the main image.

Example of a spatial collection may be multiple sensors all located indifferent positions relative to each other. Example of temporaldistribution can be a video stream.

The reference image differs from the main captured image, and themultiple reference images differ from each other in various potentialmanners which can be based on one or combination of permutations in time(temporal), position (spatial), optical characteristics, resolution, andspectral response, among other parameters.

One example is temporal disparity. In this case, the reference image iscaptured before and/or after the main captured image, and preferablyjust before and/or just after the main image. Examples may includepreview video, a pre-exposed image, and a post-exposed image. In certainembodiments, such reference image uses the same optical system as theacquired image, while in other embodiments, wholly different opticalsystems or optical systems that use one or more different opticalcomponents such as a lens, an optical detector and/or a programcomponent.

Alternatively, a reference image may differ in the location of secondarysensor or sensors, thus providing spatial disparity. The images may betaken simultaneously or proximate to or in temporal overlap with a mainimage. In this case, the reference image may be captured using aseparate sensor located away from the main image sensor. The system mayuse a separate optical system, or via some splitting of a single opticalsystem into a plurality of sensors or a plurality of sub-pixels of asame sensor. As digital optical systems become smaller dual or multisensor capture devices will become more ubiquitous. Some addedregistration and/or calibration may be typically involved when twooptical systems are used.

Alternatively, one or more reference images may also be captured usingdifferent spectral responses and/or exposure settings. One exampleincludes an infra red sensor to supplement a normal sensor or a sensorthat is calibrated to enhance specific ranges of the spectral responsesuch as skin tone, highlights or shadows.

Alternatively, one or more reference images may also be captured usingdifferent capture parameters such as exposure time, dynamic range,contrast, sharpness, color balance, white balance or combinationsthereof based on any image parameters the camera can manipulate.

Alternatively, one or more reference images may also be captured using asecondary optical system with a differing focal length, depth of field,depth of focus, exit pupil, entry pupil, aperture, or lens coating, orcombinations thereof based on any optical parameters of a designed lens.

Alternatively, one or more reference images may also capture a portionof the final image in conjunction with other differentials. Such examplemay include capturing a reference image that includes only the center ofthe final image, or capturing only the region of faces from the finalimage. This allows saving capture time and space while keeping asreference important information that may be useful at a later stage.

Reference images may also be captured using varying attributes asdefined herein of nominally the same scene recorded onto different partsof a same physical sensor. As an example, one optical subsystem focusesthe scene image onto a small area of the sensor, while a second opticalsubsystem focuses the scene image, e.g., the main image, onto a muchlarger area of the sensor. This has the advantage that it involves onlyone sensor and one post-processing section, although the twoindependently acquired scene images will be processed separately, i.e.,by accessing the different parts of the sensor array. This approach hasanother advantage, which is that a preview optical system may beconfigured so it can change its focal point slightly, and during acapture process, a sequence of preview images may be captured by movingan optical focus to different parts of the sensor. Thus, multiplepreview images may be captured while a single main image is captured. Anadvantageous application of this embodiment would be motion analysis.

Getting data from a reference image in a preview or postview process isakin to obtaining meta data rather than the image-processing that isperformed using the meta data. That is, the data used for processing amain image, e.g., to enhance its quality, is gathered from one or morepreview or postview images, while the primary source of image data iscontained within the main image itself. This preview or postviewinformation can be useful as clues for capturing and/or processing themain image, whether it is desired to perform red-eye detection andcorrection, face tracking, motion blur processing, dust artefactcorrection, illumination or resolution enhancement, image qualitydetermination, foreground/background segmentation, and/or another imageenhancement processing technique. The reference image or images may besaved as part of the image header for post processing in the capturedevice, or alternatively after the data is transferred on to an externalcomputation device. In some cases, the reference image may only be usedif the post processing software determines that there is missing data,damaged data or need to replace portions of the data.

In order to maintain storage and computation efficiency, the referenceimage may also be saved as a differential of the final image. Examplemay include a differential compression or removal of all portions thatare identical or that can be extracted from the final image.

Correcting Eye Defects

In one example involving red-eye correction, a face detection processmay first find faces, find eyes in a face, and check if the pupils arered, and if red pupils are found, then the red color pupils arecorrected, e.g., by changing their color to black. Another red-eyeprocess may involve first finding red in a digital image, checkingwhether the red pixels are contained in a face, and checking whether thered pixels are in the pupil of an eye. Depending on the quality of facedetection available, one or the other of these may be preferred. Eitherof these may be performed using one or more preview or postview images,or otherwise using a reference image, rather than or in combinationwith, checking the main image itself. A red-eye filter may be based onuse of acquired preview, postview or other reference image or images,and can determine whether a region may have been red prior to applying aflash.

Another known problem involves involuntary blinking. In this case, thepost processing may determine that the subject's eyes were closed orsemi closed. If there exists a reference image that was capturedtime-wise either a fraction of a second before or after such blinking,the region of the eyes from the reference image can replace the blinkingeye portion of the final image.

In some cases as defined above, the camera may store as the referenceimage only high resolution data of the Region of Interest (ROI) thatincludes the eye locations to offer such retouching.

Face Tools

Multiple reference images may be used, for example, in a face detectionprocess, e.g., a selected group of preview images may be used. By havingmultiple images to choose from, the process is more likely to have amore optimal reference image to operate with. In addition, a facetracking process generally utilizes two or more images anyway, beginningwith the detection of a face in at least one of the images. Thisprovides an enhanced sense of confidence that the process providesaccurate face detection and location results.

Moreover, a perfect image of a face may be captured in a referenceimage, while a main image may include an occluded profile or some otherless than optimal feature. By using the reference image, the personwhose profile is occluded may be identified and even have her headrotated and unblocked using reference image data before or after takingthe picture. This can involve upsampling and aligning a portion of thereference image, or just using information as to color, shape,luminance, etc., determined from the reference image. A correct exposureon a region of interest or ROI may be extrapolated using the referenceimage. The reference image may include a lower resolution or evensubsampled resolution version of the main image or another image ofsubstantially a same scene as the main image.

Meta data that is extracted from one or more reference images may beadvantageously used in processes involving face detection, facetracking, red-eye, dust or other unwanted image artefact detectionand/or correction, or other image quality assessment and/or enhancementprocess. In this way, meta data, e.g., coordinates and/or othercharacteristics of detected faces, may be derived from one or morereference images and used for main image quality enhancement withoutactually looking for faces in the main image.

A reference image may also be used to include multiple emotions of asingle subject into a single object. Such emotions may be used to createmore comprehensive data of the person, such as smile, frown, wink,and/or blink. Alternatively, such data may also be used to post processediting where the various emotions can be cut-and-pasted to replacebetween the captured and the reference image. An example may includeswitching between a smile to a sincere look based on the same image.

Finally, the reference image may be used for creating athree-dimensional representation of the image which can allow rotatingsubjects or the creation of three dimensional representations of thescene such as holographic imaging or lenticular imaging.

Motion Correction

A reference image may include an image that differs from a main image inthat it may have been captured at a different time before or after themain image. The reference image may have spatial differences such asmovements of a subject or other object in a scene, and/or there may be aglobal movement of the camera itself. The reference image may,preferably in many cases, have lower resolution than the main image,thus saving valuable processing time, bytes, bitrate and/or memory, andthere may be applications wherein a higher resolution reference imagemay be useful, and reference images may have a same resolution as themain image. The reference image may differ from the main image in aplanar sense, e.g., the reference image can be infrared or Gray Scale,or include a two bit per color scheme, while the main image may be afull color image. Other parameters may differ such as illumination,while generally the reference image, to be useful, would typically havesome common overlap with the main image, e.g., the reference image maybe of at least a similar scene as the main image, and/or may be capturedat least somewhat closely in time with the main image.

Some cameras (e.g., the Kodak V570, seehttp://www.dcviews.com/_kodak/v570.htm) have a pair of CCDs, which mayhave been designed to solve the problem of having a single zoom lens. Areference image can be captured at one CCD while the main image is beingsimultaneously captured with the second CCD, or two portions of a sameCCD may be used for this purpose. In this case, the reference image isneither a preview nor a postview image, yet the reference image is adifferent image than the main image, and has some temporal or spatialoverlap, connection or proximity with the main image. A same ordifferent optical system may be used, e.g., lens, aperture, shutter,etc., while again this would typically involve some additionalcalibration. Such dual mode system may include a IR sensor, enhanceddynamic range, and/or special filters that may assist in variousalgorithms or processes.

In the context of blurring processes, i.e., either removing cameramotion blur or adding blur to background sections of images, a blurredimage may be used in combination with a non-blurred image to produce afinal image having a non-blurred foreground and a blurred background.Both images may be deemed reference images which are each partly used toform a main final image, or one may be deemed a reference image having aportion combined into a main image. If two sensors are used, one couldsave a blurred image at the same time that the other takes a sharpimage, while if only a single sensor is used, then the same sensor couldtake a blurred image followed by taking a sharp image, or vice-versa. Amap of systematic dust artefact regions may be acquired using one ormore reference images.

Reference images may also be used to disqualify or supplement imageswhich have with unsatisfactory features such as faces with blinks,occlusions, or frowns.

Foreground/Background Processing

A method is provided for distinguishing between foreground andbackground regions of a digital image of a scene. The method includescapturing first and second images of nominally the same scene andstoring the captured images in DCT-coded format. These images mayinclude a main image and a reference image, and/or simply first andsecond images either of which images may comprise the main image. Thefirst image may be taken with the foreground more in focus than thebackground, while the second image may be taken with the background morein focus than the foreground. Regions of the first image may be assignedas foreground or background according to whether the sum of selectedhigh order DCT coefficients decreases or increases for equivalentregions of the second image. In accordance with the assigning, one ormore processed images based on the first image or the second image, orboth, are rendered at a digital rendering device, display or printer, orcombinations thereof.

This method lends itself to efficient in-camera implementation due tothe relatively less-complex nature of calculations utilized to performthe task.

In the present context, respective regions of two images of nominallythe same scene are said to be equivalent if, in the case where the twoimages have the same resolution, the two regions correspond tosubstantially the same part of the scene. If, in the case where oneimage has a greater resolution than the other image, the part of thescene corresponding to the region of the higher resolution image issubstantially wholly contained within the part of the scenecorresponding to the region of the lower resolution image. Preferably,the two images are brought to the same resolution by sub-sampling thehigher resolution image or upsampling the lower resolution image, or acombination thereof. The two images are preferably also aligned, sizedor other process to bring them to overlapping as to whatsoever relevantparameters for matching.

Even after subsampling, upsampling and/or alignment, the two images maynot be identical to each other due to slight camera movement or movementof subjects and/or objects within the scene. An additional stage ofregistering the two images may be utilized.

Where the first and second images are captured by a digital camera, thefirst image may be a relatively high resolution image, and the secondimage may be a relatively low resolution pre- or post-view version ofthe first image. While the image is captured by a digital camera, theprocessing may be done in the camera as post processing, or externallyin a separate device such as a personal computer or a server computer.In such case, both images can be stored. In the former embodiment, twoDCT-coded images can be stored in volatile memory in the camera for aslong as they are being used for foreground/background segmentation andfinal image production. In the latter embodiment, both images may bepreferably stored in non-volatile memory. In the case of lowerresolution pre-or-post view images, the lower resolution image may bestored as part of the file header of the higher resolution image.

In some cases only selected regions of the image are stored as twoseparated regions. Such cases include foreground regions that maysurround faces in the picture. In one embodiment, if it is known thatthe images contain a face, as determined, for example, by a facedetection algorithm, processing can be performed just on the regionincluding and surrounding the face to increase the accuracy ofdelimiting the face from the background.

Inherent frequency information as to DCT blocks is used to provide andtake the sum of high order DCT coefficients for a DCT block as anindicator of whether a block is in focus or not. Blocks whose high orderfrequency coefficients drop when the main subject moves out of focus aretaken to be foreground with the remaining blocks representing backgroundor border areas. Since the image acquisition and storage process in adigital camera typically codes captured images in DCT format as anintermediate step of the process, the method can be implemented in suchcameras without substantial additional processing.

This technique is useful in cases where differentiation created bycamera flash, as described in U.S. application Ser. No. 11/217,788,published as 2006/0039690, incorporated by reference (see also U.S. Ser.No. 11/421,027) may not be sufficient. The two techniques may also beadvantageously combined to supplement one another.

Methods are provided that lend themselves to efficient in-cameraimplementation due to the computationally less rigorous nature ofcalculations used in performing the task in accordance with embodimentsdescribed herein.

A method is also provided for determining an orientation of an imagerelative to a digital image acquisition device based on aforeground/background analysis of two or more images of a scene.

Referring to the Figures

FIG. 1 shows a block diagram of an image acquisition device 20 operatingin accordance with certain embodiments. The digital acquisition device20, which in the present embodiment is a portable digital camera,includes a processor 120. Many of the processes implemented in thedigital camera may be implemented in or controlled by software operatingin a microprocessor, central processing unit, controller, digital signalprocessor and/or an application specific integrated circuit,collectively depicted as block 120 labelled “processor”. Generically,user interfacing and control of peripheral components such as buttonsand display may be controlled by microcontroller 122. The processor 120,in response to user input at 122, such as half pressing a shutter button(pre-capture mode 32), initiates and controls the digital photographicprocess. Ambient light exposure is determined using a light sensor 40 inorder to automatically determine if a flash is to be used. The distanceto the subject is determined using a focusing mechanism 50 which alsofocuses the image on an image capture device 60. If a flash is to beused, processor 120 causes a flash device 70 to generate a photographicflash in substantial coincidence with the recording of the image by theimage capture device 60 upon full depression of the shutter button. Theimage capture device 60 digitally records the image in color. The imagecapture device is known to those familiar with the art and may include aCCD (charge coupled device) or CMOS to facilitate digital recording. Theflash may be selectively generated either in response to the lightsensor 40 or a manual input 72 from the user of the camera. The highresolution image recorded by image capture device 60 is stored in animage store 80 which may comprise computer memory such as dynamic randomaccess memory or a non-volatile memory. The camera is equipped with adisplay 100, such as an LCD, for preview and post-view of images.

In the case of preview images which are generated in the pre-capturemode 32 with the shutter button half-pressed, the display 100 can assistthe user in composing the image, as well as being used to determinefocusing and exposure. Temporary storage 82 is used to store one orplurality of the preview images and can be part of the image store 80 ora separate component. The preview image is usually generated by theimage capture device 60. For speed and memory efficiency reasons,preview images usually have a lower pixel resolution than the main imagetaken when the shutter button is fully depressed, and are generated bysub-sampling a raw captured image using software 124 which can be partof the general processor 120 or dedicated hardware or combinationsthereof. Depending on the settings of this hardware subsystem, thepre-acquisition image processing may satisfy some predetermined testcriteria prior to storing a preview image. Such test criteria may bechronological, such as to constantly replace the previous saved previewimage with a new captured preview image every 0.5 seconds during thepre-capture mode 32, until the final high resolution image is capturedby full depression of the shutter button. More sophisticated criteriamay involve analysis of the preview image content, for example, testingthe image for changes, before deciding whether the new preview imageshould replace a previously saved image. Other criteria may be based onimage analysis such as the sharpness, or metadata analysis such as theexposure condition, whether a flash will be used in the final image, thedistance to the subject, or combinations thereof.

If test criteria are not met, the camera continues by capturing the nextpreview image while storing and/or discarding preceding capturedpreviews. The process continues until the final high resolution image isacquired and saved by fully depressing the shutter button.

Where multiple preview images can be saved, a new preview image will beplaced on a chronological First-In, First-Out (FIFO) stack, until theuser takes the final picture. A reason for storing multiple previewimages is that the last preview image, or any single preview image, maynot be the best reference image for comparison with the final highresolution image in, for example, a red-eye correction process or, inthe present embodiments, portrait mode processing. By storing multipleimages, a better reference image can be achieved, and a closer alignmentbetween the preview and the final captured image can be achieved in analignment stage discussed later. Also, some processing may involve theuse of multiple preview and/or post-view images.

The camera is also able to capture and store in the temporary storage82. one or more low resolution post-view images when the camera is inportrait mode. Post-view images are essentially the same as previewimages, except that they occur after the main high resolution image iscaptured.

In this embodiment the camera 20 has a user-selectable mode 30. The usermode 30 is one which involves foreground/background segmentation of animage as part of a larger process, e.g. for applying special effectsfilters to the image or for modifying or correcting an image. Thus inthe user mode 30 the foreground/background segmentation is not an end initself. However, as the segmentation aspects of the user mode 30 arerelevant, those aspects are described further herein.

If user mode 30 is selected, when the shutter button is depressed thecamera is caused to automatically capture and store a series of imagesat close intervals so that the images are nominally of the same scene.The particular number, resolution and sequence of images, and the extentto which different parts of the image are in or out of focus, dependsupon the particular embodiment. A user mode processor 90 analyzes andprocesses the stored images according to a workflow to be described. Theprocessor 90 can be integral to the camera 20—indeed, it could be theprocessor 120 with suitable programming—or part of an externalprocessing device 10 such as a desktop computer. In this embodiment theprocessor 90 processes the captured images in DCT format. As explainedabove, the image acquisition and storage process in a digital cameratypically codes the captured images in DCT format as an intermediatestep of the process, the images being finally stored in, for example,jpg format. Therefore, the intermediate DCT-coded images can be readilymade available to the processor 90.

FIG. 2 illustrates the workflow of an embodiment of user modeprocessing. First, user mode 30 is selected at step 200. Now, when theshutter button is fully depressed, the camera automatically captures andstores two digital images in DCT format, including:

-   -   a high pixel resolution image (image A) is taken at step 202.        This image has a foreground subject of interest which is in        focus, or at least substantially more in focus than the        background.    -   a low pixel resolution post-view (or preview) image (image B) is        taken at step 204. This image has its background in focus, or at        least substantially more in focus than the foreground subject of        interest. Auto-focus algorithms in a digital camera will        typically provide support for off-centre multi-point focus which        can be used to obtain a good focus on the background. Where such        support is not available, the camera can be focussed at        infinity.

These two images are taken in rapid succession so that the scenecaptured by each image is nominally the same. In this embodiment steps200 to 206 just described take place in the camera 20. The remainingsteps now to be described can take place in the camera or in an externaldevice 10.

Images A and B are aligned in step 206, to compensate for any slightmovement in the subject or camera between taking these images. Alignmentalgorithms are well known. Then, at step 208, a high frequency (HF) mapof the foreground focussed image A is constructed by taking the sum ofselected high order DCT coefficients for each, or at least the majorityof, the DCT blocks of the image. By way of background, for an 8×8 blockof pixels, a set of 64 DCT coefficients going from the first (d.c.)component to the highest frequency component is generated. In thisembodiment, the top 25% of the DCT coefficients for a block are added toprovide an overall HF index for the block. If not all the DCT blocks ofthe image are used to construct the map, those that are should beconcentrated on the regions expected to contain the foreground subjectof interest. For example, the extreme edges of the image can often beomitted, since they will almost always be background. The resultant mapis referred to herein as Map A.

Next, step 210, an HF map (Map B) of the background focussed image B isconstructed by calculating the HF indices of the DCT blocks using thesame procedure as for Map A.

Now, step 212, a difference map is constructed by subtracting Map A fromMap B. This is done by subtracting the HF indices obtained in step 208individually from the HF indices obtained in step 210. Since Image A hasa higher resolution than image B, a DCT block in Image B will correspondto a larger area of the scene than a DCT block in Image A. Therefore,each HF index of Map A is subtracted from that HF index of Map B whoseDCT block corresponds to an area of the scene containing or, allowingfor any slight movement in the subject or camera between taking theimages, substantially containing the area of the scene corresponding tothe DCT block of Map A. This means that the HF indices for severaladjacent DCT blocks in Image A will be subtracted from the same HF indexof Map B, corresponding to a single DCT block in Image B.

At step 214, using the values in the difference map, aforeground/background map is constructed wherein each DCT block of ImageA is assigned as corresponding to a foreground or background region ofthe image according to whether the difference between its HF index andthe HF index of the DCT block of Image B from which it was subtracted instep 212 is, respectively, negative or positive.

Finally, at step 216, additional morphological, region filling andrelated image processing techniques, alone or in combination with otherforeground/background segmentation techniques, can further improve andenhance the final foreground/background map.

The final foreground/background map 218 may now be applied to theDCT-coded or jpg version of Image A for use in processing the imageaccording to the function to be performed by the user-selectable mode30.

Where the processor 90 is integral to the camera 20, the final processedjpg image may be displayed on image display 100, saved on a persistentstorage 112 which can be internal or a removable storage such as CFcard, SD card or the like, or downloaded to another device, such as apersonal computer, server or printer via image output device 110 whichcan be tethered or wireless. In embodiments where the processor 90 isimplemented in an external device 10, such as a desktop computer, thefinal processed image may be returned to the camera 20 for storage anddisplay as described above, or stored and displayed externally of thecamera.

Variations of the foregoing embodiment are possible. For example, ImageB could be a low resolution preview image rather than a post-view image.Alternatively, both Images A and B could be high resolution imageshaving the same resolution. In that case a DCT block in Image B willcorrespond to the same area of the scene as a DCT block in Image A.Thus, in step 212, the difference map would be constructed bysubtracting each HF index of Map A from a respective different HF indexof Map B, i.e. that HF index of Map B corresponding to the same or,allowing for any slight movement in the subject or camera between takingthe images, substantially the same area of the scene. In anotherembodiment both Images A and B are low resolution preview and/orpost-view images having the same resolution, and theforeground/background map derived therefrom is applied to a third,higher resolution image of nominally the same scene.

In another embodiment, rather than basing the maps and comparison on aDCT block by block analysis, each map can first be pre-processed toprovide regions, each having similar HF characteristics. For example,contiguous blocks with HF components above a given threshold are groupedtogether and contiguous blocks with HF components below a giventhreshold are grouped together. Regions from the foreground andbackground images can then be compared to determine if they areforeground or background.

In another embodiment, Images A and B may have different pixelresolutions, and prior to DCT coding, the pixel resolutions of the twoimages are matched by up-sampling the image of lower resolution and/orsub-sampling the image of higher resolution. In this context, USpublished patent applications nos. 2005/0041121 and 2006/0098890, whichare assigned to the same assignee as the present application, are herebyincorporated by reference. In this embodiment, a digitalforeground/background map may be preferably created and stored, while itmay also be possible to use the foreground/background designation of theimage region corresponding to each DCT block directly in anotheralgorithm, instead of formally creating and storing a digital map.

As mentioned above, the ability to provide foreground/backgroundseparation in an image is useful in many applications.

In other embodiments, a particular application may use aforeground/background map of an image, regardless of whether it has beencalculated using the embodiment described above or, e.g, using aflash-based technique such as that described at US published patentapplication no. 2006/0285754, which is hereby incorporated by reference.The technique may detect the orientation of an image relative to thecamera. The technique may be applicable to any digital image acquisitiondevice. For many situations, this may imply an orientation of a camerawhen the image was taken without an additional mechanical device.

Referring now to FIG. 3, in a normally-oriented camera for anormally-oriented scene, a close image foreground (in this case thesubject 330) may be at the bottom of the image and a far background atits top. Using flash-based foreground/background segmentation, beingcloser to the camera, the close foreground 330 reflects the flash morethan the far background. Thus, by computing a difference between a flashand non-flash version image of the scene, the image orientation can bedetected and camera orientation implied. A corresponding analysis mayapply when analysing DCT coefficients of two images as in the abovedescribed embodiment.

An exemplary implementation may use two reference images, e.g., previewor postview images or combinations of preview, postview and/or ordinaryimages suitably matched in resolution, one flash and one non-flash, andtransforms these into grey level. For each pixel, the grey level of thenon-flash image is subtracted from the one corresponding to the flashimage to provide a difference image. In other implementations, a ratiocould be used instead of subtraction.

For each potential image/camera orientation direction, a box is taken inthe difference image. So, for an image sensing array 310 in an uprightcamera, box 312 is associated with an upright orientation of the camera,and box 316 is associated with an inverted orientation of the camera,box 314 is associated with a clockwise rotation of the camera relativeto a scene, and box 318 is associated with an anti-clockwise rotation ofthe camera relative to the scene.

For each of boxes 312-318 of FIG. 3, an average value of the differenceimage is computed. In some implementations, the difference might only becalculated for portions of the image corresponding to the boxes 312-318.

For clarity, the boxes 312-318 of FIG. 3 are not shown as extending tothe edges of the image, however, in an exemplary implementation, for abox size=dim, the box 318 would extend from: left=0, top=0 to right=dimand bottom=image height. In other implementations, one could associateother suitable regions with a given orientation or indeed other units ofmeasurement instead of the average (i.e. histograms).

The maximum of the average values for the boxes 312-318 may be computedand the box corresponding to the largest value may be deemed to be aregion with the greatest degree of foreground vis-a-vis the remainingregions. This is deemed to indicate that this region lies at the bottomof the reference image(s). In the example of FIG. 3, the largestdifference in the difference images of the boxes should occur in box312, indicating an upright subject and implying an upright cameraorientation given the normal pose of a subject. In some implementations,box 316 might not be used as it is not a realistic in-cameraorientation.

In some implementations, it can be of benefit to run some tests in orderto validate the presumptive image orientation. For example, the maximumof the average values may be tested to determine if it is dominantvis-à-vis other values and a level of confidence can be implied fromthis dominance or otherwise. The degree of dominance involved can bevaried experimentally for different types of images (e.g.,indoor/outdoor as described in US published patent application no.2006/0285754, or day/night).

Information from other image analysis components which are used withinthe camera may also be combined for determining a level of confidence.One exemplary image analysis component is a face tracking module whichmay be operable on a stream of ordinary, preview or postview images.This component may store historical data relating to tracked faceregions, including a confidence level that a region is a face and anassociated orientation. Where multiple faces are present, their data maybe combined in determining a level of confidence.

In an example, if the difference values for the presumed left and rightsides of an image are similar and smaller then the presumed bottom andlarger than the presumed top, then it may be more (or less) likely thatthe orientation has been detected correctly.

Because foreground/background maps can be provided for both indoor andoutdoor images according to whether the maps have been created usingflash or non-flash based segmentation, knowing image orientation can beuseful in many further camera applications. For example, knowing thelikely orientation of objects in an image can reduce processing overheadin attempting to identify such objects in every possible orientation.

Processing with Faces in Digital Images

In another embodiment, a method is provided wherein one or more groupsof pixels are identified as faces or other objects or subjects within adigital acquisition device based on information from one or morereference images, which may be preview, postview or other differentimages from a main image within which it is desired to identify suchfaces, or other objects or subjects. Certain embodiments are describedbelow including methods and devices for providing and/or suggestingoptions for determining image orientation automatically using facedetection. A preferred embodiment includes an image processingapplication whether implemented in software or in firmware, as part ofthe image capture process, such as in a digital camera, or as part ofpost processing, such as a desktop, in the camera as a post processingbackground process or on a server application. This system receivesimages in digital form, where the images can be translated into a gridrepresentation including multiple pixels.

The preferred embodiment describes a method of re-using face detectioninformation in different orientations of the image to determine theorientation with the highest probability to be the correct one. Theinformation regarding the location and size of faces in an image assistin determining correct orientation.

Advantages of the preferred embodiments include the ability toautomatically perform or suggest or assist in the determination of thecorrect orientation of an image. Another advantage is that theprocessing may be automatically performed and/or suggested based on thisinformation. Such automatic processing is fast enough and efficientenough to handle multiple images in close to real time, or be used for asingle image as part of the image processing in the acquisition device.

Many advantageous techniques are provided in accordance with preferredand alternative embodiments set forth herein. For example, this methodof detection the image orientation can be combined with other methods offace detection, thus improving the functionality, and re-purposing theprocess for future applications.

Two or more methods of detecting faces in different orientations may becombined to achieve better accuracy and parameters of a single algorithmmay be concatenated into a single parameter. The digital image may betransformed to speed up the process, such as subsampling or reducing thecolor depth. The digital image may be transformed to enhance theaccuracy such as preprocessing stage for improving the color balance,exposure or sharpness. The digital image may post-processed to enhancethe accuracy, such as removal of false positives as a post processingprocess, based on parameters and criteria of the face detectionalgorithm.

Values of orientation may be adjusted such that a rotation value for thedigital image is determined. This technique may be implemented forsupporting arbitrary rotation or fixed interval rotation such as 90degree rotation.

The method may be performed within any digital image capture device,which as, but not limited to digital still camera, phone handset withbuilt in camera, web camera or digital video camera. Determining whichof the sub-group of pixels belong to which of the group of face pixelsmay be performed. The determining of the initial values of one or moreparameters of pixels may be calculated based on the spatial orientationof the one or more sub-groups that correspond to one or more facialfeatures. The spatial orientation of the one or more sub-groups thatcorrespond to one or more facial features may be calculated based on anaxis of an ellipse fit to the sub-group. The adjusted values of pixelswithin the digital image may be rounded to a closest multiple of 90degrees. The initial values may be adjusted to adjusted values forre-orienting the image to an adjusted orientation. The one or morefacial features may include an eye, two eyes, two eyes and a mouth, aneye, a mouth, hairline, ears, nostrils, nose bridge, eyebrows or a nose,or combinations thereof. On a more abstract level the features used forthe detection of objects in general in the image, or faces specificallymay be determined through a mathematical classifiers that are eitherdeduced via a learning process or inserted into the system. One exampleof such classifiers are described by Viola Jones in the paperincorporated herein by reference. Other classifiers can be theeigenfaces, which are the basis functions that define images with faces.

Each of the methods provided are preferably implemented within softwareand/or firmware either in the camera or with external processingequipment. The software may also be downloaded into the camera or imageprocessing equipment. In this sense, one or more processor readablestorage devices having processor readable code embodied thereon areprovided. The processor readable code programs one or more processors toperform any of the above or below described methods.

FIG. 4 illustrates a process flow according to a preferred embodiment.The input is an image which can come from various sources. According tothis exemplary procedure, an image may be opened by a software, firmwareor other program application in block 402. The process may be initiatedwhen a photographer takes a picture at block 403, or as an automaticbackground process for an application or acquisition device at block404.

The classifiers are preferably pre-determined for the specific imageclassification. A detailed description of the learning process to createthe appropriate classifiers can be found in the paper by Viola and Jonesthat has been cited and incorporated by reference hereinabove. Theclassifiers are loaded, at step 408, into the application.

The image is preferably rotated into three orientations at block 410.Only two or more than three orientation may alternatively be used: Thepreferred orientations are counter clockwise 412, no rotation 414 andclockwise, 416. Note that a fourth orientation which is the upside down418 is technically and theoretically plausible but is not preferred dueto the statistical improbability of such images. One or more imagesrotated by 1°, or a few seconds or minutes, or by 3° or 45°, or anarbitrary amount, may also be used.

The three images are then provided to the face detection software atblock 420 and the results are analyzed at block 430. The image with thehighest probability of detection of faces is determined at block 440 tobe most likely the one with the right orientation.

FIG. 5 is an alternative embodiment, wherein the classifiers are rotatedas opposed to the images. By doing so, even if the results are similar,the execution time is highly optimized because the process is preferablynot repeated over three images, and is instead performed over only asingle image with two, three or more times the number of classifiers.Preferably, two sets of rotated classifiers are used along with anunrotated set. According to FIG. 5, the classifiers loaded at block 408are rotated at block 460 to create counter clockwise classifiers 462,original classifiers 464 and clockwise classifiers 466. As explainedabove, if desired, a fourth set of classifiers 468 of 180 degreerotation can be generated, and in fact, any number of classifier setsmay be generated according to rotations of arbitrary or selected amountsin accordance with alternative embodiments of this invention. In a thirdembodiment, both the image and the classifiers may be rotated.

The classifiers are preferably combined into a single set of classifiersat block 470. The concatenation of the classifiers is preferablyperformed in such a manner that an false eliminating process would stillbe optimized. Note that these operations need not be executed at thetime of analysis, but can be prepared prior to running the process on animage, as a preparatory step. Also note that the two approaches may becombined, where some classifiers may or may not be used depending on theresults of the previous classifies. It may be possible to merge thepreferred three sets, or an arbitrary number of two or more sets, ofrotated classifiers.

Part-way through, the common classifiers one would branch into thespecific classifiers for each orientation. This would speed up thealgorithm because the first part of the classification would be commonto the three orientations.

In another embodiment, where the classifier set contains rotationinvariant classifiers it is possible to reduce the number of classifierswhich must be applied to an image from 3N to 3N-2M where N is the numberof classifiers in the original classifier set and M is the number ofrotation invariant classifiers. The image is then prepared at block 458to run the face detection algorithm at block 422. Such preparationvaries on the algorithm and can include different operations such asconverting the image format, the color depth, the pixel representationetc. In some cases the image is converted, such as described by Violaand Jones, to form a pixel based representation from an integral one. Inother cases the image may be subsampled to reduce computation, convertedto a gray scale representation, or various image enhancement algorithmssuch as edge enhancement, sharpening, blurring, noise reduction etc. maybe applied to the image. Numerous operations on the image in preparationmay also be concatenated. The face detection algorithm is run once onthe image at block 422, using the multiple set of classifiers 470. Theresults are then collated at block 428, according to each of the threeorientations of the preferred classifier set. The number of survivingface regions for each orientation of the classifier set are nextcompared at block 430. The orientation with the highest number ofsurviving face regions is determined at block 440 to be the one with thehighest likelihood orientation.

In an additional embodiment, the algorithm handles may handle cases offalse detection of faces. The problem occurs where in some cases regionsthat are not faces are marked as potential faces. In such cases, it isnot enough to count the occurrence of faces, but the probability offalse detection and missed faces needs to be accounted for.

Camera Motion Blur

According to another embodiment, there is provided a digital imageacquisition system comprising an apparatus for capturing digital imagesand a digital processing component for determining a camera motion blurfunction in a captured digital image based on a comparison of at leasttwo images each taken during, temporally proximate to or overlapping anexposure period of said captured image and of nominally the same scene.

Preferably, the at least two images comprise the captured image andanother image taken outside, preferably before and alternatively after,the exposure period of said captured image.

Preferably at least one reference image is a preview image.

Referring back again briefly to FIG. 1 for context, an image recorded byan image capture device 20, such as a handheld or otherwise portabledigital camera, may be stored in an image store 80 which may comprisecomputer memory such a dynamic random access memory or a non-volatilememory. The camera 20 of FIG. 1 is equipped with a display 100, such asan LCD at the back of the camera 20 or a microdisplay inside aviewfinder for viewing preview and/or post-view or other referenceimages. In the exemplary case of preview images, which may be generatedin a pre-capture mode 32, the display 100 can assist the user incomposing the image, as well as being used to determine focusing andexposure. A temporary storage space 82 may be used to store one orplurality of the preview images and may be part of the image store 80 ora separate component. The preview image may typically be generated bythe same image capture element 60, and for speed and memory efficiencyreasons may be generated by subsampling the image 124 using softwarewhich can be part of the general processor 120 or dedicated hardware,before displaying at display 100 or storing 82 the preview image.

Upon full depression of the shutter button, a full resolution image isacquired and stored at image store 80. The image may go through imageprocessing stages such as conversion from the RAW sensor pattern to RGB,format, color correction and image enhancements. These operations may beperformed as part of the main processor 120 or by using a secondaryprocessor such as a dedicated DSP. Upon completion of the imageprocessing the images are stored in a long term persistent storage suchas a removable storage device 112.

According to this embodiment, the system further includes a motionde-blurring component. This component can be implemented as firmware orsoftware running on the main processor 120 or on a separate processor.Alternatively, this component may be implemented in software running onan external processing device 10 of FIG. 1, such as a desktop or aserver, which receives the images from the camera storage 112 via theimage output mechanism 110, which can be physical removable storage,wireless or tethered connection between the camera and the externaldevice. The motion de-blurring component may include a PSF calculator(see element 498 of FIG. 6) and an image de-convolver which de-convolvesthe full resolution image using the PSF. These two components may becombined or treated separately. The PSF calculator may be used forqualification only, such as determining if motion blur exists, while theimage de-convolver may be activated only after the PSF calculator hasdetermined if de-blurring is needed.

FIG. 6 includes a flow chart of one embodiment of calculating the PSF inaccordance with certain embodiments. While the camera is in preview mode480, the camera continuously acquires preview images 482, and calculatesexposure and focus and displays the composition. When such an imagesatisfies some predefined criteria 484, the preview image is saved 486.As explained below, such criteria are preferably defined based on imagequality and/or chronological considerations. Among the criteria may beto always save the last image. More advanced image quality criteria mayinclude analysis as to whether the preview image itself has too muchmotion blurring. As an alternative to saving a single image, multipleimages may be saved 489. The newest preview image may be added to a listreplacing the oldest one, at 490 and 491 of FIG. 6. The definition ofoldest can be chronological, as in First In First Out or FIFO.Alternatively it can be the image that least satisfies criteria asdefined in stage 484. The process continues at 488, until the shutterrelease is fully pressed 492, or the camera is turned off.

The criteria 484 that a preview image is determined to satisfy can varydepending on specific implementations of the process. In one embodiment,such criteria may be whether the image is not blurred. This is based onthe assumption that even if a camera is constantly moving, being handheld by the user, there are times where the movement is zero, whetherbecause the user is firmly holding the camera or due to change ofmovement direction the movement speed is zero at a certain instance.Such criteria may not need to be absolute. In addition such criteria maybe based on one or more 1-dimensional vectors as opposed to a full twodimensional image. In other words, the criteria 484 may be satisfied ifthe image is blurred horizontally, but no vertical movement is recordedand vice versa, due to the fact that the motion may be mathematicallydescribed in orthogonal vectors, thus separable. More straight forwardcriteria will be chronological, saving images every predefined timewhich can be equal or slower to the speed the preview images aregenerated. Other criteria may be defined such as related to theexposure, whether the preview reached focus, whether flash is beingused, etc.

Finally, the full resolution image is acquired at 492 is saved at 494.After the full resolution image is saved 494, it is loaded into memory495 and the preview image or images are loaded into memory as well at496 of FIG. 6. Together the preview and final images are the input ofthe process which calculates the PSF 498.

A description of two different methods of calculating PSF is providedwith reference to FIGS. 7 a-7 b. FIG. 7 a shows an embodiment 500 forextracting a PSF using a single preview image. In this embodiment, theinput is the finally acquired full resolution image 511, and a savedpreview image 512. Prior to creating the PSF, the preview and finalimage have to be aligned. The alignment can be a global operation, usingthe entire images, 511 and 512. However, the two images may not be exactfor several reasons.

Due to the fact that the preview image and the final full resolutionimage differ temporally, there may not be a perfect alignment. In thiscase, local alignment, based on image features and using techniquesknown to those skilled in the art, will normally be sufficient. Theprocess of alignment may be performed on selected extracted regions 520,or as a local operation. Moreover, this alignment is only required inthe neighborhood of the selected region(s) or feature(s) used for thecreation of the PSF. In this case, matching regions of the fullresolution and preview image are extracted, 521 and 522. The process ofextraction of such regions may be as simple as separating the image intoa grid, which can be the entire image, or fine resolution regions. Othermore advanced schemes will include the detection of distinct regions ofinterest based on a classification process, such as detecting regionswith high contrast in color or exposure, sharp edges or otherdistinctive classifiers that will assist in isolating the PSF. Onefamiliar in the art is aware of many algorithms for analyzing anddetermining local features or regions of high contrast; frequencytransform and edge detection techniques are two specific examples thatmay be employed for this step, which may further include segmentation,feature extraction and classification steps.

The preview image 512 is normally, but not necessarily, of lowerresolution than the full resolution image 511, typically being generatedby clocking out a subset of the sensor cells or by averaging the rawsensor data. Therefore, the two images, or alternatively the selectedregions in the images, need to be matched in pixel resolution, 530. Inthe present context “pixel resolution” means the size of the image, orrelevant region, in terms of the number of pixels constituting the imageor region concerned. Such a process may be done by either upsampling thepreview image, 532, downsampling the acquired image, 531, or acombination thereof. Those familiar in the art will be aware of severaltechniques best used for such sampling methods.

Now we recall from before that:

-   -   A two dimensional image I is given as I(x,y).    -   A motion point spread function describing the blurring of image        I is given as MPSF(I).    -   The degraded image I′(x,y) can be mathematically defined as the        convolution of I(x,y) and MPSF(x,y) or        I′(x,y)=I(x,y){circumflex over (×)}MPSF(x,y)  (Eq. 1)

Now it is well known that where a mathematical function, such as theaforementioned MPSF(x,y), is convoluted with a Dirac delta functionδ(x,y) that the original function is preserved. Thus, if within apreview image a sharp point against a homogenous background can bedetermined, it is equivalent to a local occurrence of a 2D Dirac deltafunction within the unblurred preview image. If this can now be matchedand aligned locally with the main, blurred image I′(x,y) then thedistortion pattern around this sharp point will be a very closeapproximation to the exact PSF which caused the blurring of the originalimage I(x,y). Thus, upon performing the alignment and resolutionmatching between preview and main images the distortion patternssurrounding distinct points or high contrast image features, are, ineffect, representations of the 2D PSF, for points and representation ofa single dimension of the PSF for sharp, unidirectional lines.

The PSF may be created by combining multiple regions. In the simplecase, a distinguished singular point on the preview image and itscorresponding motion blurred form of this point which is found in themain full-resolution image is the PSF.

However, as it may not always be possible to determine, match and align,a single distinct point in both preview and full resolution image, it isalternatively possible to create a PSF from a combination of theorthogonal parts of more complex features such as edges and lines.Extrapolation to multiple 1-D edges and corners should be clear for onefamiliar in the art. In this case multiple line-spread-functions,depicting the blur of orthogonal lines need to be combined and analysedmathematically in order to determine a single-point PSF.

Due to statistical variances this process may not be exact enough todistinguish the PSF based on a single region. Therefore, depending onthe processing power and required accuracy of the PSF, the step offinding the PSF may include some statistical pattern matching orstatistical combination of results from multiple regions within an imageto create higher pixel and potentially sub pixel accuracy for the PSF.

As explained above, the PSF may not be shift invariant. Therefore, theprocess of determining the right PSF may be performed in various regionsof the image, to determine the variability of the PSF as a function oflocation within the image.

FIG. 7 b shows a method 600 of extrapolating a PSF using multiplepreview images.

In this embodiment, the movement of the image is extrapolated based onthe movement of the preview images. According to FIG. 7 b, the input forthis stage is multiple captured preview images 610, and the fullresolution image 620. All images are recorded with an exact time stampassociated with them to ensure the correct tracking. In most cases,preview images will be equally separated, in a manner of several imagesper second. However, this is not a requirement for this embodiment aslong as the interval between images, including the final full resolutionimage, is known.

One or more distinctive regions in a preview image are selected, 630. Bydistinctive, one refers to a region that can be isolated from thebackground, such as regions with noticeable difference in contrast orbrightness. Techniques for identifying such regions are well known inthe art and may include segmentation, feature extraction andclassification.

Each region is next matched with the corresponding region in eachpreview image, 632. In some cases not all regions may be accuratelydetermined on all preview images, due to motion blurring or objectobscurations, or the fact that they have moved outside the field of thepreview image. The coordinates of each region is recorded, 634, for thepreview images and, 636, for the final image.

Knowing the time intervals of the preview images, one can extrapolatethe movement of the camera as a function of time. When the fullresolution image 620 is acquired, the parameter that needs to berecorded is the time interval between the last captured preview imageand the full resolution image, as well as the duration of the exposureof the full resolution image. Based on the tracking before the image wascaptured, 634, and the interval before and duration of the final image,the movement of single points or high contrast image features can beextrapolated, 640, to determine the detailed motion path of the camera.

This process is illustrated in FIG. 8. According to this figure multiplepreview images 902, 904, 906, 908 are captured. In each of them aspecific region 912, 914, 916, 918 is isolated which corresponds to thesame feature in each image. The full resolution image is 910, and in itthe regions corresponding to 912, 914, 916, 918 are marked as 920. Notethat 920 may be distorted due to motion blurring.

Tracking one dimension as a function of time, the same regions areillustrated in 930 where the regions are plotted based on theirdisplacement 932, as a function of time interval 932. The objects 942,944, 946 948 and 950 correspond to the regions 912, 914, 916, 918 and920.

The motion is calculated as the line 960. This can be done usingstatistical interpolation, spline or other curve interpolation based ondiscrete sampling points. For the final image, due to the fact that thecurve may not be possible to calculate, it may also be done viaextrapolation of the original curve, 960.

The region of the final acquired image is enlarged 970 for betterviewing. In this plot, the blurred object 950 is depicted as 952, andthe portion of the curve 690 is shown as 962. The time interval in thiscase, 935 is limited to the exact length in which the exposure is beingtaken, and the horizontal displacement 933, is the exact horizontalblur. Based on that, the interpolated curve, 952, within the exposuretime interval 935, produces an extrapolation of the motion path 990.

Now, an extrapolation of the motion path may often be sufficient toyield a useful estimate of the PSF if the motion during the timeframe ofthe principle acquired image can be shown to have practically constantvelocity and practically zero acceleration. As many cameras nowincorporate sensitive gyroscopic sensors it may be feasible to determinesuch information and verify that a simple motion path analysis isadequate to estimate the motion blur PSF.

However when this is not the case (or where it is not possible toreliably make such a determination) it is still possible to estimate thedetailed motion blur PSF from a knowledge of the time separation andduration of preview images and a knowledge of the motion path of thecamera lens across an image scene. This process is illustrated in FIGS.9 and 10 and will now be described in more detail.

Any PSF is an energy distribution function which can be represented by aconvolution kernel k(x,y)-->w where (x,y) is a location and w is theenergy level at that location. The kernel k must satisfy the followingenergy conservation constraint:

∫∫k(x, y)𝕕x𝕕y = 1,which states that energy is neither lost nor gained by the blurringoperation. In order to define additional constraints that apply tomotion blur PSFs we use a time parameterization of the PSF as a pathfunction, f(t)-->(x,y) and an energy function h(t)-->w. Note that due tophysical speed and acceleration constraints, f(t) should be continuousand at least twice differentiable, where f′(t) is the velocity of the(preview) image frame and f″(t) is the acceleration at time t. By makingthe assumption that the scene radiance does not change during imageacquisition, we get the additional constraint:

${{\int_{t}^{t + {\delta\; t}}{{h(t)}{\mathbb{d}t}}} = \frac{\delta\; t}{t_{end} - t_{start}}},{{\delta\; t} > 0},{t_{start} \leq t \leq {t_{end} - {\delta\; t}}},$where [t_(start), t_(end)] is the acquisition interval for a (preview)image. This constraint states that the amount of energy which isintegrated at any time interval is proportional to the length of theinterval.

Given these constraints we can estimate a continuous motion blur PSFfrom discrete motion samples as illustrated in FIGS. 9 and 10. First weestimate the motion path, f(t), by spline interpolation as previouslydescribed above and as illustrated in FIG. 8. This path [1005] isfurther illustrated in FIG. 9.

Now in order to estimate the energy function h(t) along this path weneed to determine the extent of each image frame along this interpolatedpath. This may be achieved using the motion centroid assumptiondescribed in Ben-Ezra et al and splitting the path into frames with a1-D Voronoi tessellation as shown in FIG. 9. Since the assumption ofconstant radiance implies that frames with equal exposure times willintegrate equal amounts of energy, we can compute h(t) for each frame asshown in FIG. 10. Note that as each preview frame will typically havethe same exposure time thus each rectangle in FIG. 10, apart from themain image acquisition rectangle will have equal areas. The area of themain image rectangle, associated with capture frame 5 [1020] in thisexample, will typically be several time larger than preview image framesand may be significantly more than an order of magnitude larger if theexposure time of the main image is long.

The resulting PSF determined by this process is illustrated in FIG. 10and may be divided into several distinct parts. Firstly there is the PSFwhich is interpolated between the preview image frames [1052] and shownas a solid line; secondly there is the PSF interpolated between the lastpreview image and the midpoint of the main acquired image [1054];thirdly there is the extrapolation of the PSF beyond the midpoint of themain acquired image [1055] which, for a main image with a long exposuretime—and thus more susceptible to blurring—is more likely to deviatefrom the true PSF. Thus it may be desirable to acquire additionalpostview images, which are essentially images acquired through the samein-camera mechanism as preview images except that they are acquiredafter the main image has been acquired. This technique will allow afurther interpolation of the main image PSF [1056] with the PSFdetermined from at least one postview image.

The process may not be exact enough to distinguish the PSF based on asingle region. Therefore, depending on the processing power and accuracyneed, the step of finding the PSF may include some statistical patternmatching of multiple regions, determining multiple motion paths, thuscreating higher pixel and potentially sub pixel accuracy for the PSF.

Advantageously, a determination may be made whether a threshold amountof camera motion blur has occurred during the capture of a digitalimage. The determination is made based on a comparison of a least twoimages acquired during or proximate to the exposure period of thecaptured image. The processing occurs so rapidly, either in the cameraor in an external processing device, that the image blur determinationoccurs in “real time”. The photographer may be informed and/or a newimage capture can take place on the spot due to this real time imageblur determination feature. Preferably, the determination is made basedon a calculated camera motion blur function, and further preferably, theimage may be de-blurred based on the motion blur function, eitherin-camera or in an external processing device in real time or later on.

Dust or Other Image Artefact Detection and Correction

When either a preview or a full resolution image is acquired while thesensor is lit by the light source, the obtained calibration image willbe uniform enough to allow construction of a map of dust related defectson the CCD sensor surface. Even if the CCD surface is not uniformly lit(as a consequence of an off-center LED) the non-uniformity ispersistent, and can be thus accounted for in a map or a formula that canbe stored (in a compressed form) in a lookup table for mapping acalibration image to a final dust map.

At any suitable time after an image has been acquired, it can becompared with a dust map to identify and/or correct defects in the imageresulting from sensor defects. Where camera click-to-click interval iscritical, this processing is likely to be performed in the backgroundduring periods of camera inactivity. It is also possible that the dustmap could be used both to analyze and correct low resolution preview orpost-view images as well as full resolution acquired images.

Detection and correction of digital image artifacts that appear inimages acquired by compact digital still cameras due to the flashreflection on airborne dust particles (or small waterborne particles inunderwater photography) that are placed out of focus. An exemplarymethod uses a preview image (or other reference image), taken withoutflash just before (or during or just after) the acquisition of theactual image.

Artifacts may appear in the digital image taken with flash. The overallshape may be semi-transparent round areas, encompassed by a brighterouter edge. Within the artifact area the original content of the imageis shaded, as the “orbs” inside is matted and slightly textured.

The main approach of detecting dust artifacts is based on the extractionof edges from image luminance components and a search of circularfrontiers, and/or thresholding of a color image in the luminance andsaturation domains, and selecting regions that are relatively bright andslightly unsaturated. The computation of the local contrast (within theluminance component) could also be used.

A different approach may be used to detect orb artifacts. These could beobtained as a last preview image acquired of a scene. Since the previewis taken without flash, it offers a clean version of the scene,providing a baseline of the image content. Obtaining such a baselineimage implies the color calibration of the preview image to the finalimage, based on a linear transformation of the RGB color channels. Thetransformation is to be obtained by a minimal mean square error matchingof colors selected from the preview and the final images in uniformregions at the same spatial location. These same preview or otherreference images may be used in other applications, e.g., to detect redeye in images. The concept of the preview with no flash that has noartifact and the one with flash that has artifact is similar. Airborneartifacts may also be detected and corrected using this process.

Red-Eye Detection and Correction

A digital image acquisition device 1100 is provided. An imaging opticand detector are for acquiring digital images including one or morepreview, postview or other reference images and a main image. A facedetector module 1110 is for analyzing the one or more preview or otherreference images to ascertain information relating to candidate faceregions therein. An image generating module 1120 is for programming theprocessor to generate a sub-sampled version of the main image. A firstspeed-optimized red-eye filter 1122 is for programming the processor toproduce a first set of candidate red-eye regions in a sub-sampledversion 1124 of the main image 1126 based on the candidate face regioninformation provided by the face detector 1110.

An analysis-optimized red eye filter 1128 is for later analysis of afull resolution version of the main image based in part on the previousanalysis. The one or more preview images may include a sub-sampledversion of an acquired image.

One convenient approach to pre-determine image regions which have a highprobability of containing red-eye candidates is to performpre-processing on a set of preview images. Many state-of-art digitalcameras acquire such a stream of images captured at video rates of 15-30frames per second (fps) at a lower resolution than that provided by themain image acquisition architecture and/or programming. A set of320×240, or QVGA images is typical of many consumer cameras and the sizeand frame-rate of this preview images stream can normally be adjustedwithin certain limits.

In one embodiment, as illustrated in FIG. 11, the digital cameraincludes a face detector 1110 which operates on the preview image stream1124. The face detector 1110 may have two principle modes: (i) a fullimage search mode to detect (and confirm) new face-candidate regions1130; and (ii) a main tracking mode (1132) which predicts and thenconfirms the new location of existing face-candidates in subsequentframes of the image stream and compiles statistical information relatingto each such confirmed candidate region. Both modes can employ a varietyof methods including face detection, skin region segmentation, featuredetection including eye and mouth regions, active contour analysis andeven non-image based inputs such as directional voice analysis (e.g. US2005/0147278 to Rui et al which describes a system for automaticdetection and tracking of multiple individuals using multiple cues). Asthe first mode, hereafter referred to as the “seeding mode” is appliedto the entire image, it is computationally more intensive and is onlyapplied occasionally, e.g., every 30-60 image frames. As such, new facesappearing in the image will still be detected within a couple of secondswhich is sufficient for most consumer applications. The second mode ispreferably applied to every image frame, although not all of theanalysis cues may be applied on every frame.

Thus in normal operation only the output(s) from the second operationalmode of a face tracker algorithm will be available after every frame ofthe preview image stream. There may be three principle outputs from thissecond mode: (i) a list of candidate face regions which are confirmed tostill contain faces; and/or (ii) a set of data associated with each suchconfirmed face region including its location within that frame of theimage and various additional data determined from a statistical analysisof the history of said confirmed face region; and/or (iii) a predictedlocation for each such confirmed face region in the next frame of thepreview image stream. If item (ii) is used, item (iii) can be optionalas sufficient data may be provided by item (ii) for a determination ofpredicted location.

These outputs from the preview face detector 1110 enable the speedoptimized red-eye detector 1122 to be applied selectively to faceregions 1130 where it is expected that a red-eye defect will be found.The speed optimized filter 1122 may include a pixel locator 1136, ashape analyzer 1138 and/or falsing and verification analysis 1140. Otherimage processing may be performed 1143 including other image processingdescribed herein, e.g., blur processing, face analysis, qualityanalysis, foreground/background processing, chrominance or luminanceenhancement, and/or various others.

As further illustrated at FIG. 11, an image compressor bitmap DCT 1142may be followed by generated a DCT block map 1144, and/or an imagecompressor DCT JPEG 1146 may be provided. An image store 1150 mayinclude full size main image 1152, red eye filter meta data 1154,subsampled main images 1124 and red eye corrected main images 1156.Image acquisition parameters 1158 may also be used in this process. Animage decompressor JPEG DCT 1158 may lead to a DCT region decompressor1160 of background red eye filter module 1128. These may be controlledby unoptimized image manager 1162. The module 1128 includes an analysisoptimized red eye filter 1164 preferably including pixel locator 1166,shape analyzer 1168, falsing analyzer 1170 and pixel and region modifier1172. DCT region matching 1174 may be following by DCT regionoverwriting 1176, which may be followed by image compressor DCT JPEG1146

A face detector may be first applied to an image prior to theapplication of a red-eye filter (see, e.g. US 20020172419 to Lin et al;US 20020126893 to Held et al; US 20050232490 to Itagaki et al and US20040037460 to Luo et al.). Under normal circumstances, however, thereis not sufficient time available during the main image acquisitionchain, which is operable within a digital camera, to allow theapplication of face detector prior to the application of a red-eyefilter. An advantageous embodiment overcomes this disadvantage byemploying a predictive output of a face tracker module 1110. Althoughthe size of the predicted region will typically be larger than the sizeof the corresponding face region, it is still significantly smaller thanthe size of the entire image. Thus, advantages of faster and moreaccurate detection can be achieved within a digital camera or embeddedimage acquisition system without the need to operate a face detector1110 within the main image acquisition chain.

Note that where multiple face candidate regions 1130 are tracked, thenmultiple predicted regions will have the speed-optimized red-eye filter1122 applied.

FIG. 12 illustrates principle subfilter categories which may existwithin a main redeye filter 1200, including pixel locator and regionsegmentor 1210, shapr analyzer 1230, falsing analyzer 1250 and pixelmodifier 1270, as well as filter chain adapter 1280. While each of thecomponent filters will be referred to in sequence, it will beappreciated that where appropriate more than one of these filters may beapplied at a given time and the decisions above to modify the filterchain can include a decision not alone as to which filters may beexecuted in a sequence, but also on which filters can be applied inparallel sequences. As described above, the pixel locator and regionsegmentor 1210 includes pixel transformer filter 1211 which allowsglobal pixel-level transformations of images during color determiningand pixel grouping operations. Also, within the pixel locator and regionsegmentor 1210, there are one or more pixel color filters 1212 whichperform initial determination of whether a pixel has a color indicativeof a flash eye defect. There is also a region segmentor 1213 whichsegments pixels into candidate redeye groupings, as well as one or moreregional color filters 1214, regional color correlation filters 1215,and regional color distribution filters 1216 which operate on candidateregions based on these respective criteria. In addition, the pixellocator and region segmentor 1210 preferably includes a resegmentationengine 1217 including two additional functional blocks which do notcontribute directly to the color determining and segmentation operationsbut are nevertheless intertwined with the operation of the pixel locatorand region segmentor 1210. The resegmentation engine 1217 is afunctional block which is particularly useful for analyzing difficulteye defects. It allows region splitting 1218 and region regrouping 1219for borderline candidate regions based on a variety of thresholdcriteria.

After candidate eye-defect groupings have been determined by thesegmentor 1210, a shape analyzer 1230 next applies a set of subfiltersto determine if a particular candidate grouping is physically compatiblewith known eye-defects. Thus some basic geometric filters 1231 are firstapplied followed by one or more additional region compactness filters1232, as well as one or more boundary continuity filters 1233. Furtherdetermining is then performed by one or more region size filters 1234,and a series of additional filters then determine if neighboringfeatures exist which are indicative of eye shape 1235, eyebrows 1236 andiris regions 1237. In certain embodiments, the redeye filter mayadditionally use anthropometric data to assist in the accuratedetermining of such features.

Now the remaining candidate regions are passed to a falsing analyzer1250 which includes a range of subfilter groups which eliminatecandidate regions based on a range of criteria including lips filters1251, face region filters 1252, skin texture filters 1253, eye-glintfilters 1254, white region filters 1255, region uniformity filters 1256,skin color filters 1257, and eye-region falsing filters 1258. Further tothese standard filters a number of specialized filters may also beincluded as part of the falsing analyzer 1250. In particular, a categoryof filter may be based on the use of acquired preview images, i.e., apreview image filter 1259, which can determine if a region was red priorto applying a flash. This particular preview filter 1259 may also beincorporated as part of the initial region determining process 1210, asdescribed in co-pending U.S. application Ser. No. 10/919,226 fromAugust, 2004 entitled “Red-Eye Filter Method And Apparatus”. Anadditional category of falsing filter employs image metadata determinedfrom the camera acquisition process, as metadata based filters 1260.This category of filter can be particularly advantageous when combinedwith anthropometric data as described in PCT Application No.PCT/EP2004/008706. An additional category of filter may be a userconfirmation filter 1261 which can be optionally used to request a finaluser input at the end of the detection process. This filter can beactivated or disabled based on how sub-optimal the quality of anacquired image is, and the amount, if any, of user involvement that isdesired not desired.

The pixel modifier 1270 works with the correction of confirmed redeyeregions. Where an embodiment incorporates a face recognition module,then the pixel modifier 1270 may advantageously employ data from anin-camera known person database (not shown) to indicate aspects of theeye color of a person in the image. This can have great benefit ascertain types of flash eye-defects in an image can destroy indicationsof original eye color.

In another embodiment, an additional component of a redeye filter 1200may be a filter chain adapter 1280. This component 1280 is responsiblefor combining, and sequencing the subfilters of the redeye filter 1200and for activating each filter with a set of input parameterscorresponding to parameter list(s) 1282 supplied from an imagecompensation prefilter.

In further regard to FIG. 12, the pixel locator & region segmentor 1210,the shape analyzer 1230 and the falsing analyzer 1250 are illustrated asseparate components, however it is not intended to exclude thepossibility that subfilters from these components may be applied inout-of-order sequences. As an illustrative example, regions which passall the falsing filters except for the region uniformity filter 1256 maybe returned to the resegmentation engine 1217 to determine if the regionwas incorrectly segmented. Thus a subfilter from the pixel locator andregion segmentor 1210 may be used to add an additional capability to thefalsing analysis 1250.

Image Quality Processing

A method is provided for disqualifying an unsatisfactory scene as animage acquisition control for a camera. An analysis of the content ofthe captured image determines whether the image should be acquired ordiscarded. One example includes human faces. It may be determinedwhether an image is unsatisfactory based on whether the eyes are closed,partially closed or closing down or moving up during a blinking process.Alternatively, other non-desirable or unsatisfactory expressions oractions such as frowning, covering one's face with a hand or otheroccluding or shadowing of a facial feature or other key feature of ascene, or rotating the head away from the camera, etc., may be detected.

A present image of a scene is captured including a face region. One ormore groups of pixels is/are identified corresponding to the region ofinterest, such as an eye region, or a mouth within the face region.

In the case of blink detection, it is determined whether the eye regionis in a blinking process. If so, then the scene is disqualified as acandidate for a processed, permanent image while the eye is completingthe blinking.

The present image may include a preview image, and the disqualifying mayinclude delaying full resolution capture of an image of the scene. Thedelaying may include ending the disqualifying after a predetermined waittime.

A preview image may be used. This can provide an indication of a regionof interest (ROI) where the eyes may be in the captured image. Thisprovides a fast search in the final image of the mouth or eyes based onspatial information provided from the analysis of preview images.

The delaying may include predicting when the blinking will be completedand ending the disqualifying at approximately the predicted blinkcompletion time. The predicting may include determining a point of acomplete blinking process the scene is at, and calculating a remaindertime for completion of the blinking. The calculating may includemultiplying a fraction of the complete blinking process remaining timesa predetermined complete blinking process duration. The predeterminedcomplete blinking process duration may be programmed based on an averageblinking process duration and/or may be determined based on estimating atime from a beginning of the blinking to the present and in view of thefraction representing the point of the complete blinking process thescene is at. The estimating may be based on analyzing a temporal captureparameter of one or more previous preview images relative to that of thepresent preview image. The fraction may be determined based on whetherthe eye that is blinking is opening or closing in the present previewimage, and a degree to which the eye is open or shut.

The method may include determining whether the eye is blinking includingdetermining a degree to which the eye is open or shut. The degree towhich the eye is open or shut may be determined based on relativelyanalyzing the present preview image and one or more other preview imagesrelatively acquired within less than a duration of a complete blinkingprocess. The determining whether the eye is blinking may includedetermining a degree of blurriness of one or both eye lids. It may bedetermined what portion of a pupil, an iris, one or both eye lids or aneye white that is/are showing, or combinations thereof. A color analysisof the eye may be performed and differentiating pixels corresponding toan eye lid tone from pixels corresponding to an iris tone or pupil toneor eye white tone, or combinations thereof. A shape analysis of the eyemay be performed and pixels differentiated as corresponding to an eyelid shape contrast with those corresponding to an iris shape or pupilshape or eye white shape, or combinations thereof.

The present image may include a full resolution capture image. Thedisqualifying may include foregoing further processing of the presentimage. It may be determined whether the eye is blinking includingdetermining a degree to which the eye is open or shut. This may includerelatively analyzing the present preview image and one or more otherpreview images relatively acquired within less than a duration of acomplete blinking process. The determination of whether the eye isblinking may be based on determining a degree of blurriness of one orboth eye lids.

The method may include determining a portion of a pupil, an iris, one orboth eye lids or an eye white that is/are showing, or combinationsthereof. A color analysis of the eye may be performed and pixelsdifferentiated as corresponding to an eye lid tone contrasted withpixels corresponding to an iris tone or pupil tone or eye white tone, orcombinations thereof. A shape analysis of the eye may be performed andpixels differentiated as corresponding to an eye lid shape contrastedwith pixels corresponding to an iris shape or pupil shape or eye whiteshape, or combinations thereof.

The present image may include a full resolution capture image. Themethod may include assembling a combination image including pixels fromthe present image and open-eye pixels corresponding to the eye that isblinking from a different image. The different image may include apreview image or a post-view image or another full resolution image. Thedifferent image may include a lower resolution than the present image,and the assembling may include upsampling the different image ordownsampling the present image, or a combination thereof. The method mayalso include aligning the present image and the different image,including matching an open-eye pixel region to a blinking eye region inthe present image.

A further method is provided for automatically disqualifying anunsatisfactory scene as an image acquisition control of a camera. Themethod includes acquiring multiple preview images. Information isextracted from the multiple preview images. One or more changes is/areanalyzed in the scene between individual images of the multipletemporary images. Based on the analyzing, it is determined whether oneor more unsatisfactory features exist within the scene. The scene isdisqualified as a candidate for a processed, permanent image while theone or more unsatisfactory features continue to exist.

One or more processor readable storage devices having processor readablecode embodied thereon are also provided. The processor readable code isfor programming one or more processors to perform a method ofdisqualifying an unsatisfactory scene as an image acquisition controlfor a camera, as set forth herein above or below. The processor may beembedded as part of the camera or external to the acquisition device.The acquisition device may be a hand held camera, a stationary camera, avideo camera, a mobile phone equipped with a acquisition device, a handheld device equipped with a acquisition device, a kiosk booth, such asones used for portraits, a dedicated portrait camera such as one usedfor security or identifications or generically, any image capturedevice.

An image may be generated as a combination of a present image, and apreview, post-view or other full resolution image. For example, thecombination image may include a face region and some background imagery,wherein one or both eye regions, which are unsatisfactorily closed orpartially closed in the present image, are replaced with one or bothopen eyes from the preview, post-view or other full resolution image.This feature may be combined with features presented in U.S. patentapplication Ser. No. 10/608,776. In the '776 application, a method ofdigital image processing using face detection is described. A group ofpixels is identified that corresponds to a face within a digital image.A second group of pixels is identified that corresponds to anotherfeature within the digital image. A re-compositioned image is determinedincluding a new group of pixels for at least one of the face and theother feature.

In one embodiment, the camera will take the picture right after thesubject completes a blinking process. The present system can be used todisqualify an image having a subject whose eyes are closed, and can takemultiple images to prevent having no images that lack blinking. One ofthe images will likely have eyes open for each subject person, and thepictures can have a mixture of pixels combined into a single image withno eyes blinking. The camera may decide on the number of images to takebased on the number of subjects in the image. The more people, thehigher the likelihood of one person blinking, thus more images should beacquired. If it is acceptable for efficiency that a certain percentageof persons may be blinking in a large group shot, e.g., that is below acertain amount, e.g., 5%, then the number of images can be reduced.These threshold numbers and percentage tolerances can be selected by acamera product manufacturer, program developer, or user of a digitalimage acquisition apparatus. This information may be generated based onanalysis of preview images. The preview image may also assist indetermining the location of the eyes, so that the post processinganalysis can be faster honing into the region of interest as determinedby the preview analysis.

The present system sets a condition under which a picture will not betaken or will not be used or further processed after it has already beentaken, and/or where an additional image or images will be taken toreplace the unsatisfactory image. Thus, another advantageous feature ofa system in accordance with a preferred embodiment is that it cancorrect an acquired blink region with a user's eye information from apreview or post-view image or another full resolution image. The presentsystem preferably uses preview images, which generally have lowerresolution and may be processed more quickly. The present system canalso look for comparison of changes in facial features (e.g., of theeyes or mouth), between images as potentially triggering a disqualifyingof a scene for an image capture. In such a case, the system maydistinguish between a squint which is somewhat permanent or of longerduration during the session than a blink which is more a temporarystate. The system may also through a comparison of multiple imagesdetermine the difference between eyes that are naturally narrow due tothe location of the upper-eye-lid or the epicanthal fold, or based on adetermined nationality of a subject person, e.g., distinguishing Asianfrom Caucasian eyes.

FIGS. 13 and 14 illustrate a method of predicting a blinking completiontime interval including determining a degree to which an eye is open orshut, respectively, in accordance with certain embodiments. Variousoptions are provided at FIGS. 13 and 14 for inclusion in the process. At1290, the process includes predicting when a blinking will be completedand ending a disqualifying at a predicted blinking completion time. Thispreferably includes a blinking detection sub-process. The disqualifyingcould be ended after a predetermined wait time at 1291, e.g., whensomeone may actually be asleep rather than blinking. A point at which acomplete blinking process is at may be determined at 1292, and aremainder of time for completion of the blinking may be calculated. Adetermined fraction of a complete blinking process remaining times apredetermined complete blinking process duration may be performed at1293. At 1294, a complete blinking process duration based on an averageblinking process duration is programmed into the camera or otherpre-capture or post-capture processing apparatus. At 1295, a completeblinking process duration is determined based on estimating a time froma beginning of the blinking to present, and in view of the determinedfraction. For example, if the determined fraction is one third, and thetime from the beginning of the blinking to present is determined to be0.09 seconds, the complete blink time estimated to be 0.27 seconds, ofwhich 0.18 second remain. At 1297, the estimation may be based onanalyzing a temporal capture parameter of one of more previous previewimages relative to that of the present image. For example, if a previouspreview image shows a start of the blinking process, and the cameraknows that the previous preview image was captured 0.08 seconds earlier,and the fraction is one third, then the blinking process may bepredicted to end after another 0.16 seconds. At 1296, the fraction isdetermined, including determining whether the blinking eye is opening orclosing, and further determining a degree to which the eye is open orshut.

The determining a degree to which an eye may be open or shut is furtherprovided at 1310 of FIG. 13. To do this, the present image is preferablyanalyzed at 1320 relative to one or more other preview images acquiredwithin less than a duration of a complete blinking process. An optionaldetermination of a degree of blurriness at 1330 of one or both eye lidsmay facilitate a determination of blink speed. A portion of a pupil,iris, one or both eye lids or an eye white that is/are showing may bedetermined at 1340 to facilitate determining how open or shut theblinking eye is. Color analysis 1350 and shape analysis 1360 may also beperformed to differentiate pixels corresponding to features of open eyessuch as a pupil, an iris and/or an eye white, from pixels correspondingto features of shut eyes, or eye lids that would appear in an eye regionof a present scene.

FIG. 15 illustrates a method of assembling a combination image inaccordance with a preferred embodiment. At 1480, a combination image isassembled including pixels from a present image and open eye pixels froma different image that correspond to the eye that is blinking in thepresent image. The different image may be a preview or postview image1490. In this case, particularly if the preview or postview image haslower resolution than the present image, then at 1500 the preview imagemay be upsampled or the postview image may be downsampled, or acombination thereof. The present image and the different image arepreferably aligned at 1510 to match the open eye pixel region in thepreview of postview image to the blinking eye region in the presentimage.

In an alternative embodiment, eye detection software may be activatedinside a camera or other handheld or portable device, as part of anacquisition process. In this scenario, the eye detection portion may beimplemented differently to support real time or near real timeoperation. Such implementation may include sub-sampling of the image,and weighted sampling to reduce the number of pixels on which thecomputations are performed. This embodiment is further described withreference to FIG. 16.

FIG. 16 describes a process that uses face detection to improve incamera acquisition parameters. In this scenario, a camera is activatedat 1600, for example by means of half pressing the shutter, turning onthe camera, etc. The camera then goes through the normal pre-acquisitionstage to determine at 1604 the correct acquisition parameters such asaperture, shutter speed, flash power, gain, color balance, white point,or focus. In addition, a default set of image attributes, particularlyrelated to potential faces in the image, are loaded at 1602. Suchattributes can be the overall color balance, exposure, contrast,orientation etc. Alternatively, a collection of preview images may beanalyzed to determine the potential existence of faces in the picture. Aregion wherein potentially the eyes will be when the full resolution iscaptured may also be predicted. This alternative technique may theninclude moving on to block 1610 and/or 1602.

At 1602, default values are loaded and/or determined for imageattributes. Then at 1650, values of attributes, e.g., of one or morereference images, particularly preview images, are compared in capturedregions to default or other reference image attribute values. Imagecapture may be delayed at 1660 while the attributes match default imageattributes. Manual override instructions may be accepted at 1670. Aphotographer may take a picture at 1690.

At 1610, a camera captures a main or reference image. At 1620, thecamera seeks eyes in the image. If no eye has been detected at 1630,then the process exits at 1632. Eyes may be manually added at 1634. Ifeyes are detected, then regions are marked or otherwise identified aseyes at 1640. False detected eye regions may be removed at 1644. At1646, selected regions may be manually graded based on importance. Then,the process moves to 1650, 1660, 1670 and 1690 as introduced above.

In an alternative embodiment, the eye detection can then also make useof information provided from preview images to determine the location ofthe eyes in preview, thus expediting the analysis being performed in asmaller region on the final image.

In an alternative embodiment, the eye detection software may beactivated inside the rendering device as part of the output process. Inthis scenario, the eye detection portion may be implemented eitherwithin the rendering device, using the captured image or using a singleor plurality of preview images, or within an external driver to suchdevice. This embodiment is further described with reference to FIG. 17(see below).

Referring to FIG. 17, a process is described for using eye, face orother feature detection to improve output or rendering parameters. Inthis scenario, a rendering device such as a printer or a display,hereinafter referred to as “the device” is activated at 2100. Suchactivation can be performed for example within a printer, oralternatively within a device connected to the printer such as a PC or acamera. The device then goes through a normal pre-rendering stage todetermine at 2104, the correct rendering parameters such as tonereproduction, color transformation profiles, gain, color balance, whitepoint and resolution. In addition, a default set of image attributes,particularly related to potential eyes or faces in the image, are loadedat 2102. Such attributes can be the overall color balance, exposure,contrast, or orientation, or combinations thereof.

An image is then digitally downloaded onto the device 2110. Animage-detection process, preferably an eye or a face detection process,is applied to the downloaded image to seek eyes or faces in the image at2120. If no images are found, the process terminates at 2132 and thedevice resumes its normal rendering process. Alternatively, or inaddition to the automatic detection of 2130, the user can manuallyselect 2134 detected eyes or faces or other features, using someinteractive user interface mechanism, by utilizing, for example, adisplay on the device. Alternatively, the process can be implementedwithout a visual user interface by changing the sensitivity or thresholdof the detection process.

When eyes or faces are detected at 2130, they are marked at 2140, andlabeled. Detecting in 2130 may be more than a binary process ofselecting whether an eye or a face is detected or not. It may also bedesigned as part of a process where each of the eyes or faces is given aweight based on size of the faces, location within the frame, otherparameters described herein, etc., which define the importance of theeye or face in relation to other eyes or faces detected.

Alternatively, or in addition, the user can manually deselect regions at2144 that were wrongly false detected as eyes or faces. Such selectioncan be due to the fact that an eye or face was false detected or whenthe photographer may wish to concentrate on one or two of the eyes orone of the faces as the main subject matter and not on other eyes orfaces. Alternatively, 2146, the user may re-select, or emphasize one ormore eyes or faces to indicate that these eyes or faces have a higherimportance in the calculation relative to other eyes or faces. Thisprocess as defined in 1146, further defines the preferred identificationprocess to be a continuous value one as opposed to a binary one. Theprocess can be done utilizing a visual user interface or by adjustingthe sensitivity of the detection process.

After the eyes or faces or other scene or image features are correctlyisolated at 2140, their attributes are compared at 2150 to defaultvalues that were predefined in 2102. At least one preferred attributethat the process is looking for is blinking eyes. Such comparison willdetermine a potential transformation between the two images, in order toreach the same values. The image may be disqualified at 2160 if one ormore eyes are determined to be blinking. The disqualifying may beoverridden manually at 2170 or open eye pixels may be substituted from adifferent image. The transformation may be translated to the devicerendering parameters, and the image at 2190 may be rendered. The processmay include a plurality of images. In this case at 2180, the processrepeats itself for each image prior to performing the rendering process.A practical example is the creation of a thumbnail or contact sheetwhich is a collection of low resolution images, on a single displayinstance.

A practical example is that if the eyes or face were too darklycaptured, the rendering parameters may change the tone reproductioncurve to lighten the eyes or face. Note that the image attributes arenot necessarily only related to the eye or face regions, but can also bein relation to an overall tone reproduction.

FIG. 18 describes extracting pertinent features of a face, which areusually highly detectable. Such objects may include the eyes, 2140, 2160and 2240, 2260, and the lips, 2180 and 2280, or the nose, eye brows, eyelids, features of the eyes, hair, forehead, chin, ears, etc. Thecombination of the two eyes (or two eyebrows, two ears or two nostrils,etc.) and the center of the lips (or nose or chin, etc.) creates atriangle which can be detected not only to determine the orientation ofthe face but also the rotation of the face relative to a facial shot.Note that there are other highly detectable portions of the image whichcan be labeled and used for orientation detection, such as the nostrils,the eyebrows, the hair line, nose, bridge and the neck as the physicalextension of the face, etc. In this figure, the eyes and lips areprovided as an example of such facial features Based on the location ofthe eyes, if found, and the mouth, the image might ought to be rotatedin a counter clockwise direction.

Note that it may not be enough to just locate the different facialfeatures, but such features may be compared to each other. For example,the color of the eyes may be compared to ensure that the pair of eyesoriginated from the same person.

Alternatively, the features of the face may be compared with previewimages. Such usage may prevent a case where a double upper eyelid may bemistaken to a semi closed eye. If the software combines the mouth of2180 with the eyes of 2260, 2240 as illustrated at FIG. 18, theorientation would have been determined as clockwise. In this case, thesoftware detects the correct orientation by comparing the relative sizeof the mouth and the eyes. The above method describes exemplary andillustrative techniques for determining the orientation of the imagebased on the relative location of the different facial objects. Forexample, it may be desired that the two eyes should be horizontallysituated, the nose line perpendicular to the eyes, the mouth under thenose etc. Alternatively, orientation may be determined based on thegeometry of the facial components themselves. For example, it may bedesired that the eyes are elongated horizontally, which means that whenfitting an ellipse on the eye, such as described in blocs 2140 and 2160,it may be desired that the main axis should be horizontal. Similar withthe lips which when fitted to an ellipse the main axis should behorizontal. Alternatively, the region around the face may also beconsidered. In particular, the neck and shoulders which are the onlycontiguous skin tone connected to the head can be an indication of theorientation and detection of the face.

Face (or Other Subject) Tracking

FIG. 19 illustrates primary subsystems of an image processing apparatusincluding a face tracking system in accordance with another embodiment.The solid lines indicate the flow of image data; the dashed lineindicates control inputs or information outputs (e.g. location(s) ofdetected faces) from a module. In this example an image processingapparatus can be a digital still camera (DSC), a video camera, a cellphone equipped with an image capturing mechanism or a hand help computerequipped with an internal or external camera.

A digital image is acquired in raw format from an image sensor (CCD orCMOS) 3105 and an image subsampler 3112 generates a smaller copy of themain image. Most digital cameras already contain dedicated hardwaresubsystems to perform image subsampling, for example to provide previewimages to a camera display. Typically the subsampled image is providedin bitmap format (RGB or YCC). In the meantime the normal imageacquisition chain performs post-processing on the raw image 3110 whichtypically includes some luminance and color balancing. In certaindigital imaging systems the subsampling may occur after suchpost-processing, or after certain post-processing filters are applied,but before the entire post-processing filter chain is completed.

The subsampled image is next passed to an integral image generator 3115which creates an integral image from the subsampled image. This integralimage is next passed to a fixed size face detector 3120. The facedetector is applied to the full integral image, but as this is anintegral image of a subsampled copy of the main image, the processingrequired by the face detector is proportionately reduced. If thesubsample is one quarter of the main image, this implies the involvedprocessing time will be only 25% of what would be involved for the fullimage.

This approach is particularly amenable to hardware embodiments where thesubsampled image memory space can be scanned by a fixed size DMA windowand digital logic to implement a Haar-feature classifier chain can beapplied to this DMA window. However, this does not preclude the use ofseveral sizes of classifier (in a software embodiment), or the use ofmultiple fixed-size classifiers (in a hardware embodiment). The keyadvantage is that a smaller integral image is calculated.

After application of the fast face detector 3280 any newly detectedcandidate face regions 3141 are passed onto a face tracking module 3111where any face regions confirmed from previous analysis 3145 are mergedwith the new candidate face regions prior to being provided 3142 to aface tracker 3290.

In alternative embodiments, sub-sampled preview images for the cameradisplay can be fed through a separate pipe than the images being fed toand supplied from the image sub-sampler 3112 and so every acquired imageand its sub-sampled copies can be available both to the detector 3280 aswell as for camera display.

In addition to periodically acquiring samples from a video stream, theprocess may also be applied to a single still image acquired by adigital camera. In this case, the stream for the face tracking comprisesa stream of preview images and the final image in the series is the fullresolution acquired image. In such a case, the face tracking informationcan be verified for the final image. In addition, the information suchas coordinates or mask of the face may be stored with the final image.Such data for example may fit as an entry in the saved image header, forfuture post processing, whether in the acquisition device or at a laterstage by an external device.

When the confidence factor is sufficiently high for a region, indicatingthat at least one face is in fact present in an image frame, the camerafirmware runs a light-weight face recognition algorithm 3160 at thelocation of the face, for example a DCT-based algorithm. The facerecognition algorithm 3160 uses a database 3161 preferably stored on thecamera comprising personal identifiers and their associated faceparameters.

In operation, the module 3160 collects identifiers over a series offrames. When the identifiers of a detected face tracked over a number ofpreview frames are predominantly of one particular person, that personis deemed by the recognition module to be present in the image. Theidentifier of the person, and the last known location of the face, maybe stored either in the image (in a header) or in a separate file storedon the camera storage 3150. This storing of the person's ID can occureven when the recognition module 3160 fails for the immediately previousnumber of frames but for which a face region was still detected andtracked by the module 3111.

When the image is copied from camera storage to a display or permanentstorage device such as a PC (not shown), the person's ID's are copiedalong with the images. Such devices are generally more capable ofrunning a more robust face detection and recognition algorithm and thencombining the results with the recognition results from the camera,giving more weight to recognition results from the robust facerecognition (if any). The combined identification results are presentedto the user, or if identification was not possible, the user is asked toenter the name of the person that was found. When the user rejects anidentification or a new name is entered, the PC retrains its face printdatabase and downloads the appropriate changes to the capture device forstorage in the light-weight database 3161.

When multiple confirmed face regions 3145 are detected, the recognitionmodule 3160 can detect and recognize multiple persons in the image.

Further Alternative Embodiments

Multiple images taken at different focal lengths may be used to simulatefill-flash (see 2003/0052991 to Stavely et al.). These multiple imagesmay be of different sizes, and/or they may misaligned, and/or they maybe captured outside of a main acquisition process, such that describedembodiments regarding use of preview/postview images in a camera wouldbe advantageous

A subsampled (or blurred) version of a main image may be used (see U.S.Pat. No. 6,249,315 to Holm), and according to described embodimentsabove subsampled preview images may be used as a reference image.

A scene may be “sensed” for regional brightness and range to subjectprior to main image capture (see, e.g., 2001/0031142 to Whiteside). Inaccordance with certain embodiments, a preview image may be madeavailable in a camera which is configured to perform the sensing.

Digital scene analysis may be performed for brightness adjustment (see,e.g., U.S. Pat. No. 5,724,456 to Boyack et al.). A system may beprovided for processing a digital image signal representing an imagethat contains luminance and/or chrominance data. The luminance data maybe mapped to a tonal reproduction capability of a destinationapplication. An image signal may be acquired and the luminance data maybe separated from the image signal. In accordance with certainembodiment, the image signal that is acquired may include a previewimage or other reference image. The image signal may be converted andtemporarily stored as a pixelated digital image. The luminance andchrominance data may be digitally processed.

Also, features have been described that relate to face tracking. Inaddition, a user may teach a camera by presenting the camera with a viewof an object, such that the camera may then seek to control a trackingmotor so as to keep the object in view, and/or a zoom motor such thatthe size of the object with respect to the overall image remains fixedat the region learned by the camera. In a further embodiment, a model ofa person's head may be provided such that the camera can correctlyidentify the head, or others like it, within it's field of view. Thusthe device seeks to maintain a lock on a target. Such may be performedmechanistically or according to software and/or firmware provided withinthe camera. Advantageously, multiple targets such as multiple faces orfacial regions may be tracked and/or zoomed, and preferably digitallyenhanced, e.g., in view of aesthetic considerations.

While an exemplary drawings and specific embodiments of the presentinvention have been described and illustrated, it is to be understoodthat that the scope of the present invention is not to be limited to theparticular embodiments discussed. Thus, the embodiments shall beregarded as illustrative rather than restrictive, and it should beunderstood that variations may be made in those embodiments by workersskilled in the arts without departing from the scope of the presentinvention as set forth in the claims that follow and their structuraland functional equivalents.

In addition, in methods that may be performed according to the claimsbelow and/or preferred embodiments herein, the operations have beendescribed in selected typographical sequences. However, the sequenceshave been selected and so ordered for typographical convenience and arenot intended to imply any particular order for performing theoperations, unless a particular ordering is expressly provided orunderstood by those skilled in the art as being necessary.

In addition, all references cited herein, as well as the background,invention summary, abstract and brief description of the drawings, areincorporated by reference into the detailed description of the preferredembodiments as disclosing alternative embodiments, including:

U.S. Pat. Nos. RE33682, RE31370, 4,047,187, 4,317,991, 4,367,027,4,448,510, 4,638,364, 5,291,234, 5,488,429, 5,638,136, 5,710,833,5,724,456, 5,781,650, 5,805,727, 5,812,193, 5,818,975, 5,835,616,5,870,138, 5,900,909, 5,949,904, 5,978,519, 5,991,456, 6,035,072,6,097,470, 6,101,271, 6,125,213, 6,128,397, 6,148,092, 6,151,073,6,160,923, 6,188,777, 6,192,149, 6,233,364, 6,249,315, 6,263,113,6,266,054, 6,268,939, 6,282,317, 6,298,166, 6,301,370, 6,301,440,6,332,033, 6,393,148, 6,404,900, 6,407,777, 6,421,468, 6,438,264,6,456,732, 6,459,436, 6,473,199, 6,501,857, 6,504,942, 6,504,951,6,516,154, 6,526,161, 6,614,946, 6,621,867, 6,661,907, 6,747,690,6,873,743, 6,965,684, 7,031,548, and 7,035,462;

US published patent applications nos. 2001/0031142, 2002/0051571,2002/0090133, 2002/0102024, 2002/0105662, 2002/0114535, 2002/0176623,2002/0172419, 2002/0126893, 2002/0102024, 2003/0025812, 2003/0039402,2003/0052991, 2003/0071908, 2003/0091225, 2003/0193604, 2003/0219172,2004/0013286, 2004/0013304, 20040037460, 2004/0041121, 2004/0057623,2004/0076335, 2004/0119851, 2004/0120598, 2004/0223063, 2005/0031224,2005/0041121, 2005/0047655, 2005/0047656, 2005/0068446, 2005/0078173,2005/0140801, 2005/0147278, 20050232490, 2006/0120599, 2006/0039690,2006/0098237, 2006/0098890, 2006/0098891, 2006/0140455, 2006/0204055,2006/0204110, 2006/0285754, and 2007/0269108

U.S. patent application Ser. No. 11/764,339;

Japanese patent application no. JP5260360A2;

British patent application no. GB0031423.7;

Published PCT application no. WO-03/019473;

PCT Applications Nos. PCT/EP2004/008706, and PCT/EP2004/010199;

http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/FAVARO1/dfdtutorial.html;

Anlauf, J. K. and Biehl, M.: “The adatron: and adaptive perceptionalgorithm”. Neurophysics Letters, 10:687-692, 1989;

Baluja & Rowley, “Neural Network-Based Face Detection,” IEEETransactions on Pattern Analysis and Machine Intelligence, Vol. 20, No.1, pages 23-28, January 1998;

Baluja, Shumeet in “Face Detection with In-Plane rotation: EarlyConcepts and Preliminary Results”, Technical Report JPRC-TR-97-001;

Endo, M., “Perception of upside-down faces: and analysis form theviewpoint of cue saliency”, in Ellis, H. Jeeves, M., Newcombe, F., andYoung, A., editors, Aspects of Face Processing, 53-58, 1986, MatnusNijhoff Publishers;

Moses, Yael and Ullman, Shimon and Shimon Edelman in “Generalization toNovel Images in Upright and Inverted Faces”, 1994;

Le Saux, Bertrand and Amato, Giuseppe: “Image Classifiers for SceneAnalysis”, International Conference on Computer Vision and Graphics(ICCVG'04), Warsaw, Poland, September 2004;

Valentine, T., Upside Down Faces: A review of the effect of inversionand encoding activity upon face recognition”, 1988, Acta Psychologica,61:259-273;

Viola and Jones “Robust Real Time Object Detection”,2^(nd) internationalworkshop on Statistical and Computational theories of Vision, inVancouver, Canada, Jul. 31, 2001;

Yang et al., IEEE Transactions on Pattern Analysis and MachineIntelligence, Vol. 24, no. 1, pp 34-58 (January 2002);

Motion Deblurring Using Hybrid Imaging”, by Moshe Ben-Ezra and Shree K.Nayar, from the Proceedings IEEE Computer Society Conference on ComputerVision and Pattern Recognition, 2003;

“Automatic Multidimensional Deconvolution” J. Opt. Soc. Am. A, vol.4(1), pp. 180-188, January 1987 to Lane et al;

“Some Implications of Zero Sheets for Blind Deconvolution and PhaseRetrieval”, J. Optical Soc. Am. A, vol. 7, pp. 468-479, 1990 to Bates etal;

Iterative Blind Deconvolution Algorithm Applied to Phase Retrieval”, J.Opt. Soc. Am. A, vol. 7(3), pp. 428-433, March 1990. to Seldin et al;

“Deconvolution and Phase Retrieval With Use of Zero Sheets,” J. OpticalSoc. Am. A, vol. 12, pp. 1,842-1,857, 1995 to Bones et al.;

“Digital Image Restoration”, Prentice Hall, 1977 authored by Andrews, H.C. and Hunt, B. R., and

“Deconvolution of Images and Spectra” 2nd. Edition, Academic Press,1997, edited by Jannson, Peter A.

What is claimed is:
 1. A method of determining an orientation of animage relative to a digital image acquisition device, comprising: (a)capturing a main image and one or more relatively low resolutionreference images of a same scene with said digital image acquisitiondevice; (b) comparing at least a portion of said main image and said oneor more reference images adjacent the corresponding edges of said mainand reference images to determine whether said portion comprisesrelatively more foreground than background; and (c) responsive to saidportion comprising more than a threshold degree of foreground,determining that said images are oriented with said portion at theirbottom, and (d) wherein said threshold is varied according to whethersaid main and reference images are classified as being indoor oroutdoor.
 2. The method of claim 1, wherein said two images comprise aflash image and a non-flash image and in which said comparing comprisescomparing luminance levels of pixels of said portion.
 3. The method ofclaim 1, wherein said two images comprise non-flash images and in whichsaid comparing comprises comparing higher order DCT coefficients for atleast one block of said portion.
 4. The method of claim 1, wherein saidcomparing comprises comparing respective portions adjacent a pluralityof edges of said two images, and wherein a portion which is determinedto include a greatest degree of foreground relative to other portions isdeemed to be located at a bottom of said images.
 5. The method of claim4, wherein the portion is deemed to be located at the bottom of saidimages based at least in part on its degree of foreground exceeding adegree of foreground for a portion adjacent an opposite edge by a giventhreshold.
 6. The method of claim 5, wherein said threshold is alsovaried according to exposure level of said images.
 7. The method ofclaim 4, wherein a portion is deemed to be located at the bottom of saidimages when its degree of foreground exceeds a degree of foreground fora portion adjacent at least an adjacent edge, and a degree of foregroundfor a portion adjacent said adjacent edge exceeds a degree of foregroundfor a portion adjacent an opposite edge.
 8. A hand-held or otherwiseportable or spatial or temporal performance-based image capture device,comprising: (a) one or more lenses, an aperture and a photodetector forcapturing an original main image and one or more reference images havinga temporal or spatial overlap or proximity with the original image, orcombinations thereof; (b) a processor; (c) one or moreprocessor-readable media having embedded therein programming code forthe processor to perform a digital image processing method ofdetermining an orientation of an image relative to a digital imageacquisition device, the method comprising: (i) capturing a main imageand one or more relatively low resolution reference images of a samescene with said digital image acquisition device; (ii) comparing atleast a portion of said main image and said one or more reference imagesadjacent the corresponding edges of said main and reference images todetermine whether said portion comprises relatively more foreground thanbackground; and (iii) responsive to said portion comprising more than athreshold degree of foreground, determining that said images areoriented with said portion at their bottom, and (iv) wherein saidthreshold is varied according to whether said main and reference imagesare classified as being indoor or outdoor.
 9. The image capture deviceof claim 8, wherein said two images comprise a flash image and anon-flash image and in which said comparing comprises comparingluminance levels of pixels of said portion.
 10. The image capture deviceof claim 8, wherein said two images comprise non-flash images and inwhich said comparing comprises comparing higher order DCT coefficientsfor at least one block of said portion.
 11. The image capture device ofclaim 8, wherein said comparing comprises comparing respective portionsadjacent a plurality of edges of said two images, and wherein a portionwhich is determined to include a greatest degree of foreground relativeto other portions is deemed to be located at a bottom of said images.12. The image capture device of claim 11, wherein the portion is deemedto be located at the bottom of said images based at least in part on itsdegree of foreground exceeding a degree of foreground for a portionadjacent an opposite edge by a given threshold.
 13. The image capturedevice of claim 12, wherein said threshold is also varied according toexposure level of said images.
 14. The image capture device of claim 11,wherein a portion is deemed to be located at the bottom of said imageswhen its degree of foreground exceeds a degree of foreground for aportion adjacent at least an adjacent edge, and a degree of foregroundfor a portion adjacent said adjacent edge exceeds a degree of foregroundfor a portion adjacent an opposite edge.